phoenixnap.bmc.private_network (1.17.0) — module

Create/delete private network on phoenixNAP Bare Metal Cloud.

| "added in version" 0.11.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 private 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 new private network for account
  hosts: localhost
  gather_facts: false
  vars_files:
    - ~/.pnap/config.yaml
  tasks:
    - name: Create private network
      phoenixnap.bmc.private_network:
        client_id: "{{ clientId }}"
        client_secret: "{{ clientSecret }}"
        name: My Default Backend Network
        location: PHX
        location_default: true
        description: My Default Backend Network
        cidr: 10.0.0.0/24
        state: present
      register: output
    - name: Print the private network information
      ansible.builtin.debug:
        var: output.private_networks
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Delete private network
  hosts: localhost
  gather_facts: false
  vars_files:
    - ~/.pnap/config.yaml
  tasks:
    - name: Delete network
      phoenixnap.bmc.private_network:
        client_id: "{{ clientId }}"
        client_secret: "{{ clientSecret }}"
        name: My Default Backend Network
        state: absent
      register: output
    - name: Print the private networks information
      ansible.builtin.debug:
        var: output.private_networks

Inputs

    
cidr:
    description: IP range associated with this private network in CIDR notation.
    type: str

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

force:
    description:
    - parameter controlling advanced features availability.
    - Currently applicable for networking. It is advised to use with caution since it
      might lead to unhealthy setups.
    type: bool

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 private network.
    - Once a network is created, it cannot be modified through a playbook
    type: str

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

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

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

location_default:
    default: false
    description:
    - Identifies network as the default private network for the specified location.
    - Once a network is created, it cannot be modified through a playbook
    type: bool

Outputs

private_networks:
  contains:
    cidr:
      description: IP range associated with this private network in CIDR notation.
      returned: always
      sample: 10.0.0.0/24
      type: str
    createdOn:
      description: Date and time when this private network was created.
      returned: always
      type: str
    description:
      description: The description of this private network..
      returned: always
      sample: Further details on the network
      type: str
    id:
      description: The private network identifier.
      returned: always
      sample: 604721852cf65253d151528b
      type: str
    location:
      description: The location of this private network.
      returned: always
      sample: PHX
      type: str
    locationDefault:
      description: Identifies network as the default private network for the specified
        location.
      returned: always
      sample: true
      type: bool
    memberships:
      contains:
        ips:
          description: List of IPs associated to the resource
          elements: str
          example:
          - 10.111.14.104
          - 10.111.14.105
          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 of this private network.
      returned: always
      type: list
    name:
      description: The friendly name of this private network.
      returned: always
      sample: Sample Network
      type: str
    status:
      description: The status of the private network.
      sample: READY
      type: str
    type:
      description: The type of the private network.
      returned: always
      sample: PRIVATE
      type: str
    vlanId:
      description: The VLAN of this private network.
      returned: always
      sample: 10
      type: str
  description: The private networks information as list
  returned: success
  type: complex