Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamically add host record to next available ip with an exclusion list #244

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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

1 participant