cisco.intersight.intersight_ip_pool module – IP Pool configuration for Cisco Intersight

Note

This module is part of the cisco.intersight collection (version 2.2.0).

You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install cisco.intersight.

To use it in a playbook, specify: cisco.intersight.intersight_ip_pool.

Synopsis

  • IP Pool configuration for Cisco Intersight.

  • Used to configure IP pools settings on Cisco Intersight managed devices.

  • For more information see Cisco Intersight.

Parameters

Parameter

Comments

api_key_id

string / required

Public API Key ID associated with the private key.

If not set, the value of the INTERSIGHT_API_KEY_ID environment variable is used.

api_private_key

path / required

Filename (absolute path) or string of PEM formatted private key data to be used for Intersight API authentication.

If a string is used, Ansible vault should be used to encrypt string data.

Ex. ansible-vault encrypt_string –vault-id tme@/Users/dsoper/Documents/vault_password_file ‘—–BEGIN EC PRIVATE KEY—–

<your private key data>

—–END EC PRIVATE KEY—–’

If not set, the value of the INTERSIGHT_API_PRIVATE_KEY environment variable is used.

api_uri

string

URI used to access the Intersight API.

If not set, the value of the INTERSIGHT_API_URI environment variable is used.

Default: "https://intersight.com/api/v1"

description

aliases: descr

string

The user-defined description of the IP Pool.

Description can contain letters(a-z, A-Z), numbers(0-9), hyphen(-), period(.), colon(:), or an underscore(_).

enable_block_level_subnet_config

boolean

Determines if the “Netmask”, “Gateway”, “PrimaryDns” and “SecondaryDns” is globally defined or specified per IPv4 block.

Determines if the “Prefix”, “Gateway”, “PrimaryDns” and “SecondaryDns” is globally defined or specified per IPv6 block.

Choices:

  • false ← (default)

  • true

ipv4_blocks

list / elements=dictionary

List of the IPv4 blocks.

Should include the ipv4_config details per block in case “enable_block_level_subnet_config” is true

from

string

First IPv4 address of the block.

ipv4_config

dictionary

Block definition of IPv4 “Netmask”, “Gateway”, “PrimaryDns” and “SecondaryDns”.

Used only when “enable_block_level_subnet_config” is true, otherwise should be defined globally.

gateway

string

The Gateway IP used for the current IPv4 block.

netmask

string

The Netmask used for the current IPv4 block.

primary_dns

string

The PrimaryDns IP used for the current IPv4 block.

secondary_dns

string

The SecondaryDns IP used for the current IPv4 block.

size

integer

Number of identifiers this block can hold.

ipv4_config

dictionary

Global definition of IPv4 “Netmask”, “Gateway”, “PrimaryDns” and “SecondaryDns”.

Used only when “enable_block_level_subnet_config” is false, otherwise should be defined inside ipv4_blocks.

gateway

string

IP address of the default IPv4 gateway.

Gateway IP used for all IPv4 blocks.

netmask

string

A subnet mask is a 32-bit number that masks an IP address and divides the IP address into network address and host address.

Netmask used for all IPv4 blocks.

primary_dns

string

IP Address of the primary Domain Name System (DNS) server.

PrimaryDns IP used for all IPv4 blocks.

secondary_dns

string

IP Address of the secondary Domain Name System (DNS) server.

SecondaryDns IP used for all IPv4 blocks.

ipv6_blocks

list / elements=dictionary

Define the IPv6 blocks.

Should include the ipv6_config details per block in case “enable_block_level_subnet_config” is true

from

string

The initial IP address for the IPv6 block.

ipv6_config

dictionary

Block definition of IPv6 “Prefix”, “Gateway”, “PrimaryDns” and “SecondaryDns”.

Used only when “enable_block_level_subnet_config” is true, otherwise should be defined globally.

gateway

string

The Gateway IP used for the current IPv6 block.

prefix

integer

The Prefix used for the current IPv6 block.

primary_dns

string

The PrimaryDns IP used for the current IPv6 block.

secondary_dns

string

The SecondaryDns IP used for the current IPv6 block.

size

integer

The number of IPs in the block.

ipv6_config

dictionary

Global definition of IPv6 “Prefix”, “Gateway”, “PrimaryDns” and “SecondaryDns”.

Used only when “enable_block_level_subnet_config” is false, otherwise should be defined inside ipv6_blocks.

gateway

string

IP address of the default IPv6 gateway.

Gateway IP used for all IPv6 blocks.

prefix

string

A prefix length which masks the IP address and divides the IP address into network address and host address.

Prefix used for all IPv6 blocks.

primary_dns

string

IP Address of the primary Domain Name System (DNS) server.

PrimaryDns IP used for all IPv6 blocks.

secondary_dns

string

IP Address of the secondary Domain Name System (DNS) server.

SecondaryDns IP used for all IPv6 blocks.

name

string / required

The name assigned to the IP Pool.

The name must be between 1 and 62 alphanumeric characters, allowing special characters :-_.

organization

string

The name of the Organization this resource is assigned to.

Profiles, Policies, and Pools that are created within a Custom Organization are applicable only to devices in the same Organization.

Default: "default"

state

string

If present, will verify the resource is present and will create if needed.

If absent, will verify the resource is absent and will delete if needed.

Choices:

  • "present" ← (default)

  • "absent"

tags

list / elements=dictionary

List of tags in Key:<user-defined key> Value:<user-defined value> format.

use_proxy

boolean

If no, it will not use a proxy, even if one is defined in an environment variable on the target hosts.

Choices:

  • false

  • true ← (default)

validate_certs

boolean

Boolean control for verifying the api_uri TLS certificate

Choices:

  • false

  • true ← (default)

Examples

- name: Configure IP Pool with global config
  cisco.intersight.intersight_ip_pool:
    api_private_key: "{{ api_private_key }}"
    api_key_id: "{{ api_key_id }}"
    organization: DevNet
    name: lab-ip-pool
    description: IP Pool for lab use
    ipv4_config:
      netmask: "255.255.255.0"
      gateway: "172.17.116.1"
      primary_dns: "172.17.116.2"
      secondary_dns: "172.17.116.3"
    ipv4_blocks:
      - from: "172.17.116.32"
        size: 16
      - from: "172.17.116.64"
        size: 16
    ipv6_config:
      prefix: 64
      gateway: "2001:db8::1"
      primary_dns: "2001:4860:4860::8888"
      secondary_dns: "2001:4860:4860::8844"
    ipv6_blocks:
      - from: "2001:db8::2"
        size: 64
      - from: "2001:db8::42"
        size: 64
    tags:
      - Key: Site
        Value: RCDN


- name: Configure IP Pool with block level config
  cisco.intersight.intersight_ip_pool:
    api_private_key: "{{ api_private_key }}"
    api_key_id: "{{ api_key_id }}"
    organization: DevNet
    name: lab-ip-pool
    description: IP Pool for lab use
    enable_block_level_subnet_config: true
    ipv4_blocks:
      - from: "172.17.116.32"
        size: 16
        ipv4_config:
          netmask: "255.255.255.0"
          gateway: "172.17.116.1"
          primary_dns: "172.17.116.2"
          secondary_dns: "172.17.116.3"
      - from: "172.17.117.32"
        size: 16
        ipv4_config:
          netmask: "255.255.255.0"
          gateway: "172.17.117.1"
          primary_dns: "172.17.117.2"
          secondary_dns: "172.17.117.3"
    ipv6_blocks:
      - from: "2001:db8::2"
        size: 64
        ipv6_config:
          prefix: 64
          gateway: "2001:db8::1"
          primary_dns: "2001:4860:4860::8888"
          secondary_dns: "2001:4860:4860::8844"
      - from: "fd12:3456:789a::1"
        size: 64
        ipv6_config:
          prefix: 64
          gateway: "fd12:3456:789a::1"
          primary_dns: "2606:4700:4700::1111"
          secondary_dns: "2606:4700:4700::1001"
    tags:
      - Key: Site
        Value: RCDN


- name: Delete IP Pool
  cisco.intersight.intersight_ip_pool:
    api_private_key: "{{ api_private_key }}"
    api_key_id: "{{ api_key_id }}"
    organization: DevNet
    name: lab-ip-pool
    state: absent

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key

Description

api_repsonse

dictionary

The API response output returned by the specified resource.

Returned: always

Sample: {"api_response": {"AccountMoid": "", "Ancestors": [], "Assigned": 0, "AssignmentOrder": "sequential", "ClassId": "ippool.Pool", "CreateTime": "", "Description": "IP Pool for lab use", "DomainGroupMoid": "", "EnableBlockLevelSubnetConfig": true, "IpV4Blocks": [], "IpV4Config": {}, "IpV6Blocks": [], "IpV6Config": {}, "ModTime": "", "Moid": "", "Name": "lab-ip-pool", "ObjectType": "ippool.Pool", "Organization": {}, "Owners": [], "PermissionResources": [], "Reservations": [], "Reserved": 0, "ShadowPools": [], "SharedScope": "", "Size": 160, "Tags": [{"Key": "Site", "Value": "RCDN"}], "V4Assigned": 0, "V4Size": 32, "V6Assigned": 0, "V6Size": 128}}

Authors

  • Shahar Golshani (@sgolshan)