phoenixnap.bmc.public_network (1.17.0) — module

Create/delete public network on phoenixNAP Bare Metal Cloud.

| "added in version" 1.5.0 of phoenixnap.bmc"

Authors: Pavle Jojkic (@pajuga) <pavlej@phoenixnap.com>, Goran Jelenic (@goranje) <goranje@phoenixnap.com>

preview | supported by certified

Install collection

Install with ansible-galaxy collection install phoenixnap.bmc:==1.17.0


Add to requirements.yml

  collections:
    - name: phoenixnap.bmc
      version: 1.17.0

Description

Create/delete public network on phoenixNAP Bare Metal Cloud.

This module has a dependency on requests

API is documented at U(https://developers.phoenixnap.com/docs/networks/1/overview).

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# All the examples assume that you have file config.yaml with your 'clientId' and 'clientSecret'
# in location: ~/.pnap/config.yaml

- name: Create a public network.
  hosts: localhost
  gather_facts: false
  vars_files:
    - ~/.pnap/config.yaml
  tasks:
    - name: Create a public network.
      phoenixnap.bmc.public_network:
        client_id: "{{ clientId }}"
        client_secret: "{{ clientSecret }}"
        name: Initial public network
        location: PHX
        description: My first public network 1
        ip_blocks:
          - id: 60473a6115e34466c9f8f083
          - id: 616e6ec6d66b406a45ab8797
        state: present
      register: output
    - name: Print the networks information
      ansible.builtin.debug:
        var: output.public_networks
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Delete network
  hosts: localhost
  gather_facts: false
  vars_files:
    - ~/.pnap/config.yaml
  tasks:
    - name: Delete network
      phoenixnap.bmc.public_network:
        client_id: "{{ clientId }}"
        client_secret: "{{ clientSecret }}"
        name: Initial public network
        state: absent
      register: output
    - name: Print the networks information
      ansible.builtin.debug:
        var: output.public_networks

Inputs

    
name:
    description: The friendly name of this public network.
    type: str

state:
    choices:
    - present
    - absent
    default: present
    description: Indicate desired state of the target.
    type: str

vlan_id:
    description: The VLAN that will be assigned to this network.
    type: int

location:
    description:
    - The location of this public network.
    - Once a network is created, it cannot be modified through a playbook
    type: str

client_id:
    description: Client ID (Application Management)
    type: str

ip_blocks:
    description:
    - A list of IP Blocks that will be associated with this public network.
    - Once a network is created, it cannot be modified through a playbook
    elements: dict
    suboptions:
      id:
        description: The assigned IP block to the Public Network.
        type: str
    type: list

description:
    description: The description of this public network.
    type: str

client_secret:
    description: Client Secret (Application Management)
    type: str

Outputs

public_networks:
  contains:
    createdOn:
      description: Date and time when this public network was created.
      sample: '2022-04-05T13:50:30.491Z'
      type: str
    description:
      description: The description of this public network.
      sample: Further details on the network.
      type: str
    id:
      description: The public network identifier.
      sample: 604721852cf65253d151528b
      type: str
    ipBlocks:
      contains:
        id:
          description: The IP Block identifier.
          sample: 60473a6115e34466c9f8f083
          type: str
      description: A list of IP Blocks that are associated with this public netwo
      type: list
    location:
      description: The location of this public network.
      sample: PHX
      type: str
    memberships:
      contains:
        ips:
          description: List of public IPs associated to the resource.
          elements: str
          sample:
          - 10.111.14.104
          - 10.111.14.105
          - 10.111.14.106
          type: list
        resourceId:
          description: The resource identifier.
          sample: 603f3e995c18d515cda9c4f8
          type: str
        resourceType:
          description: The resource's type.
          sample: server
          type: str
      description: A list of resources that are members in this public network.
      type: list
    name:
      description: The friendly name of this public network.
      sample: Sample Network
      type: str
    status:
      description: he status of the public network.
      sample: READY
      type: str
    vlanId:
      description: The VLAN of this public network.
      sample: 10
      type: int
  description: Public ntworks information as list
  returned: success
  type: complex