phoenixnap.bmc.ip_block (1.17.0) — 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.17.0


Add to requirements.yml

  collections:
    - name: phoenixnap.bmc
      version: 1.17.0

Description

Create/delete IP blocks.

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/

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

Inputs

    
tags:
    description: Tags to set to the ip-block.
    elements: dict
    suboptions:
      name:
        description: The name of the tag.
        type: str
      value:
        description: The value of the tag assigned to the resource.
        type: str
    type: list

count:
    description:
    - Specifies the number of IP Blocks.
    - Defined value allow IP blocks to be deleted if they are not used
    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. Using ip_block_id, it can be edited later.
    - Multiple descriptions create/remove multiple IP Blocks.
    elements: str
    type: list

ip_block_id:
    description:
    - The IP Block identifier.
    - A description can be edited or a certain IP block can be deleted.
    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_blocks:
  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
    createdOn:
      description: Date and time when the IP block was created.
      sample: '2021-03-13T20:24:32.491Z'
      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
    isBringYourOwn:
      description: True if the IP block is a bring your own block.
      sample: true
      type: bool
    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
    tags:
      contains:
        createdBy:
          description: Who the tag was created by.
          sample: USER
          type: str
        id:
          description: The unique id of the tag.
          sample: 60ffafcdffb8b074c7968dad
          type: str
        isBillingTag:
          description: Whether or not to show the tag as part of billing and invoices
          sample: true
          type: bool
        name:
          description: The name of the tag.
          sample: Environment
          type: str
        value:
          description: The value of the tag assigned to the resource.
          sample: PROD
          type: str
      description: The tags assigned if any.
      returned: always
      type: list
  description: Information about IP Block that were created/removed
  returned: success
  type: complex