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.4.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 infoblox.nios\_modules. You need further requirements to be able to use this lookup plugin, see Requirements for details.

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

New in infoblox.nios_modules 1.0.0

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

Terms

Parameter

Comments

Terms

string / required

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

Parameters

Parameter

Comments

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 Value

Key

Description

Return value

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.