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.7.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 |
---|---|
The CIDR network to retrieve the next address(es) from. |
Keyword parameters
This describes keyword parameters of the lookup. These are the values key1=value1
, key2=value2
and so on in the following
examples: lookup('infoblox.nios_modules.nios_next_ip', key1=value1, key2=value2, ...)
and query('infoblox.nios_modules.nios_next_ip', key1=value1, key2=value2, ...)
Parameter |
Comments |
---|---|
List of IP’s that need to be excluded from returned IP addresses. |
|
The network view to retrieve the CIDR network from. Default: |
|
The number of IP address(es) to return. Default: |
|
Use DHCP range to retrieve the next available IP address(es). Requested number of IP Addresses must be between 1 and 20. Choices:
|
Notes
Note
When keyword and positional parameters are used together, positional parameters must be listed before keyword parameters:
lookup('infoblox.nios_modules.nios_next_ip', term1, term2, key1=value1, key2=value2)
andquery('infoblox.nios_modules.nios_next_ip', term1, term2, key1=value1, key2=value2)
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 next available IP address for network 192.168.10.0/24 from DHCP range
ansible.builtin.set_fact:
ipaddr: "{{ lookup('infoblox.nios_modules.nios_next_ip', '192.168.10.0/24',
use_range=true, provider={'host': 'nios01', 'username': 'admin', 'password': 'password'}) }}"
- name: return next available IP address for network 192.168.10.0/24 in a non-default network view
ansible.builtin.set_fact:
ipaddr: "{{ lookup('infoblox.nios_modules.nios_next_ip', '192.168.10.0/24', network_view='ansible',
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 |
---|---|
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.