phoenixnap.bmc.network (1.4.0) — module

Create/delete 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.4.0


Add to requirements.yml

  collections:
    - name: phoenixnap.bmc
      version: 1.4.0

Description

Create/delete 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

# Create network

- name: Create new network for account
  hosts: localhost
  gather_facts: false
  vars_files:
    - ~/.pnap/config.yaml
  collections:
    - phoenixnap.bmc
  tasks:
  - phoenixnap.bmc.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 networks information
    debug:
      var: output.networks
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Delete network

- name: Delete network
  hosts: localhost
  gather_facts: false
  vars_files:
    - ~/.pnap/config.yaml
  collections:
    - phoenixnap.bmc
  tasks:
  - phoenixnap.bmc.network:
      client_id: "{{clientId}}"
      client_secret: "{{clientSecret}}"
      name: My Default Backend Network
      state: absent
    register: output
  - name: Print the networks information
    debug:
      var: output.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

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

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

changed:
  description: True if a network was created or removed.
  returned: success
  sample: true
  type: bool
network:
  description: Information about network that was created/removed
  returned: success
  sample: '{"id": "604724a5a807f2d3be8660c7", "name": My Default Backend Network,
    "type": "PRIVATE", "location": "PHX", "locationDefault": true, "vlanId": 10, "description":
    "My Default Backend Network", "cidr": "10.0.0.0/24", "servers": []}'
  type: dict