infoblox.nios_modules.nios_next_ip lookup – Return the next available IP address for a network

Note

This lookup plugin is part of the infoblox.nios_modules collection (version 1.2.2).

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 infoblox.nios_modules.

To use it in a playbook, specify: infoblox.nios_modules.nios_next_ip.

New in version 1.0.0: of infoblox.nios_modules

Synopsis

  • Uses the Infoblox WAPI API to return the next available IP addresses for a given network CIDR

Requirements

The below requirements are needed on the local controller node that executes this lookup.

  • infoblox-client

Parameters

Parameter

Comments

_terms

string / required

The CIDR network to retrieve the next address(es) from.

exclude

list / elements=string

List of IP’s that need to be excluded from returned IP addresses.

num

integer

The number of IP address(es) to return.

Default: 1

Examples

- name: return next available IP address for network 192.168.10.0/24
  ansible.builtin.set_fact:
    ipaddr: "{{ lookup('infoblox.nios_modules.nios_next_ip', '192.168.10.0/24', provider={'host': 'nios01', 'username': 'admin', 'password': 'password'}) }}"

- name: return the next 3 available IP addresses for network 192.168.10.0/24
  ansible.builtin.set_fact:
    ipaddr: "{{ lookup('infoblox.nios_modules.nios_next_ip', '192.168.10.0/24', num=3,
                provider={'host': 'nios01', 'username': 'admin', 'password': 'password'}) }}"

- name: return the next 3 available IP addresses for network 192.168.10.0/24 excluding ip addresses - ['192.168.10.1', '192.168.10.2']
  ansible.builtin.set_fact:
    ipaddr: "{{ lookup('infoblox.nios_modules.nios_next_ip', '192.168.10.0/24', num=3, exclude=['192.168.10.1', '192.168.10.2'],
                provider={'host': 'nios01', 'username': 'admin', 'password': 'password'}) }}"

- name: return next available IP address for network fd30:f52:2:12::/64
  ansible.builtin.set_fact:
    ipaddr: "{{ lookup('infoblox.nios_modules.nios_next_ip', 'fd30:f52:2:12::/64', provider={'host': 'nios01', 'username': 'admin', 'password': 'password'}) }}"

Return Values

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

Key

Description

_list

list / elements=string

The list of next IP addresses available

Returned: always

Hint

Configuration entries for each entry type have a low to high priority order. For example, a variable that is lower in the list will override a variable that is higher up.