phoenixnap.bmc.ip_address (1.3.1) — module

Create/delete IP block.

| "added in version" 1.2.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.3.1


Add to requirements.yml

  collections:
    - name: phoenixnap.bmc
      version: 1.3.1

Description

Create/delete IP block.

An IP Block is a set of contiguous IPs that can be assigned to other resources such as servers.

The server module can also create and delete IP Blocks in some cases.

This module has a dependency on requests

API is documented at U(https://developers.phoenixnap.com/docs/ips/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
# and generated SSH key pair in location: ~/.ssh/

# Request an IP Block.

- name: Request an IP Block.
  hosts: localhost
  gather_facts: false
  vars_files:
    - ~/.pnap/config.yaml
  collections:
    - phoenixnap.bmc
  tasks:
  - phoenixnap.bmc.ip_address:
      client_id: "{{clientId}}"
      client_secret: "{{clientSecret}}"
      location: PHX
      cidr_block_size: /28
      state: present
    register: output
  - name: Print the gathered infos
    debug:
      var: output.ip_addresses
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Delete an IP Block.

- name: Delete an IP Block.
  hosts: localhost
  gather_facts: false
  vars_files:
    - ~/.pnap/config.yaml
  collections:
    - phoenixnap.bmc
  tasks:
  - phoenixnap.bmc.ip_address:
      client_id: "{{clientId}}"
      client_secret: "{{clientSecret}}"
      ip_block_id: 6047127fed34ecc3ba8402d2
      state: absent
    register: output
  - name: Print the gathered infos
    debug:
      var: output.ip_addresses

Inputs

    
count:
    default: 1
    description: xx
    type: int

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

location:
    description: IP Block location ID.
    type: str

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

description:
    description: The description of the IP Block.
    type: str

ip_block_id:
    description: The IP Block identifier.
    type: str

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

cidr_block_size:
    description: CIDR IP Block Size.
    type: str

Outputs

changed:
  description: True if an IP Block was created or removed.
  returned: success
  sample: true
  type: bool
ip_addresses:
  contains:
    assignedResourceId:
      description: ID of the resource assigned to the IP Block.
      returned: always
      sample: 6047127fed34ecc3ba8402d2
      type: str
    assignedResourceType:
      description: Type of the resource assigned to the IP Block.
      returned: always
      sample: server
      type: str
    cidr:
      description: The IP Block in CIDR notation.
      returned: always
      sample: 1.1.1.0/31
      type: str
    cidrBlockSize:
      description: CIDR IP Block Size.
      sample: /30
      type: str
    description:
      description: The description of the IP Block.
      sample: IP Block
      type: str
    id:
      description: IP Block identifier.
      returned: always
      sample: 6047127fed34ecc3ba8402d2
      type: str
    location:
      description: IP Block location ID.
      returned: always
      sample: PHX
      type: str
    status:
      description: The status of the IP Block.
      returned: always
      sample: unassigned
      type: str
  description: Information about IP Block that were created/removed
  returned: success
  type: complex