Skip to content

Conversation

@hmalphettes
Copy link
Contributor

The usage of nios_next_ip when creating a host record has a few limitations:

  • a list of IPs to exclude cannot be defined
  • a DHCP range cannot be the target

These changes support passing the function call as documented in https://ipam.illinois.edu/wapidoc/objects/record.host_ipv4addr.html:

For example

- name: >
    Dynamically add host record to next available ip in
    a network and excluding a list of IPs
    see https://ipam.illinois.edu/wapidoc/objects/record.host_ipv4addr.html
  infoblox.nios_modules.nios_host_record:
    name: host.ansible.com
    ipv4:
      - address:
        _object_function: next_available_ip
        _parameters:
          exclude: ['192.168.10.1', '192.168.10.2', '192.168.10.3'],
        _result_fields: ips
        _object: network
        _object_parameters:
          network: 192.168.10.0/24
    comment: this is a test comment
    state: present
    provider:
      host: "{{ inventory_hostname_short }}"
      username: admin
      password: admin
  connection: local

I realize this is done fairly quickly without test units and other missing pieces before it can be merged.
I appreciate your guidance: let me know if this is interesting for the community and if this is the right syntax to expose.
Thanks!

@hmalphettes hmalphettes force-pushed the create-host-with-exclude-support branch from 46af31a to b1fbf71 Compare July 27, 2024 09:25
@hmalphettes hmalphettes force-pushed the create-host-with-exclude-support branch from b1fbf71 to 735351d Compare July 27, 2024 09:57
@bewing
Copy link

bewing commented Oct 29, 2025

Would be awesome if this could be generically available on other objects that support functions (networks, etc)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants