community.general.nios_host_record – Configure Infoblox NIOS host records

Note

This plugin is part of the community.general collection (version 2.5.1).

To install it use: ansible-galaxy collection install community.general.

To use it in a playbook, specify: community.general.nios_host_record.

Synopsis

  • Adds and/or removes instances of host record objects from Infoblox NIOS servers. This module manages NIOS record:host objects using the Infoblox WAPI interface over REST.

  • Updates instances of host record object from Infoblox NIOS servers.

Requirements

The below requirements are needed on the host that executes this module.

  • infoblox-client

Parameters

Parameter Choices/Defaults Comments
aliases
list / elements=string
Configures an optional list of additional aliases to add to the host record. These are equivalent to CNAMEs but held within a host record. Must be in list format.
comment
string
Configures a text string comment to be associated with the instance of this object. The provided text string will be configured on the object instance.
configure_for_dns
boolean
    Choices:
  • no
  • yes ←
Sets the DNS to particular parent. If user needs to bypass DNS user can make the value to false.

aliases: dns
extattrs
dictionary
Allows for the configuration of Extensible Attributes on the instance of the object. This argument accepts a set of key / value pairs for configuration.
ipv4addrs
list / elements=dictionary
Configures the IPv4 addresses for this host record. This argument accepts a list of values (see suboptions)

aliases: ipv4
add
boolean
added in 0.2.0 of community.general
    Choices:
  • no
  • yes
If user wants to add the ipv4 address to an existing host record. Note that with add user will have to keep the state as present, as new IP address is allocated to existing host record. See examples.
configure_for_dhcp
boolean
    Choices:
  • no
  • yes
Configure the host_record over DHCP instead of DNS, if user changes it to true, user need to mention MAC address to configure

aliases: dhcp
ipv4addr
string / required
Configures the IPv4 address for the host record. Users can dynamically allocate ipv4 address to host record by passing dictionary containing, nios_next_ip and CIDR network range. If user wants to add or remove the ipv4 address from existing record, add/remove params need to be used. See examples

aliases: address
mac
string
Configures the hardware MAC address for the host record. If user makes DHCP to true, user need to mention MAC address.
remove
boolean
added in 0.2.0 of community.general
    Choices:
  • no
  • yes
If user wants to remove the ipv4 address from an existing host record. Note that with remove user will have to change the state to absent, as IP address is de-allocated from an existing host record. See examples.
ipv6addrs
list / elements=dictionary
Configures the IPv6 addresses for the host record. This argument accepts a list of values (see options)

aliases: ipv6
configure_for_dhcp
boolean
    Choices:
  • no
  • yes
Configure the host_record over DHCP instead of DNS, if user changes it to true, user need to mention MAC address to configure
ipv6addr
string / required
Configures the IPv6 address for the host record

aliases: address
mac
string
Configures the hardware MAC address for the host record. If user makes DHCP to true, user need to mention MAC address.
name
string / required
Specifies the fully qualified hostname to add or remove from the system. User can also update the hostname as it is possible to pass a dict containing new_name, old_name. See examples.
provider
dictionary
A dict object containing connection details.
host
string
Specifies the DNS host name or address for connecting to the remote instance of NIOS WAPI over REST
Value can also be specified using INFOBLOX_HOST environment variable.
http_pool_connections
integer
Default:
10
Number of pools to be used by the infoblox_client.Connector object.
This is passed as-is to the underlying requests.adapters.HTTPAdapter class.
http_pool_maxsize
integer
Default:
10
Maximum number of connections per pool to be used by the infoblox_client.Connector object.
This is passed as-is to the underlying requests.adapters.HTTPAdapter class.
http_request_timeout
integer
Default:
10
The amount of time before to wait before receiving a response
Value can also be specified using INFOBLOX_HTTP_REQUEST_TIMEOUT environment variable.
max_results
integer
Default:
1000
Specifies the maximum number of objects to be returned, if set to a negative number the appliance will return an error when the number of returned objects would exceed the setting.
Value can also be specified using INFOBLOX_MAX_RESULTS environment variable.
max_retries
integer
Default:
3
Configures the number of attempted retries before the connection is declared usable
Value can also be specified using INFOBLOX_MAX_RETRIES environment variable.
password
string
Specifies the password to use to authenticate the connection to the remote instance of NIOS.
Value can also be specified using INFOBLOX_PASSWORD environment variable.
silent_ssl_warnings
boolean
    Choices:
  • no
  • yes ←
Disable urllib3 SSL warnings in the infoblox_client.Connector object.
This is passed as-is to the underlying requests.adapters.HTTPAdapter class.
username
string
Configures the username to use to authenticate the connection to the remote instance of NIOS.
Value can also be specified using INFOBLOX_USERNAME environment variable.
validate_certs
boolean
    Choices:
  • no ←
  • yes
Boolean value to enable or disable verifying SSL certificates
Value can also be specified using INFOBLOX_SSL_VERIFY environment variable.

aliases: ssl_verify
wapi_version
string
Default:
"2.1"
Specifies the version of WAPI to use
Value can also be specified using INFOBLOX_WAP_VERSION environment variable.
Until ansible 2.8 the default WAPI was 1.4
state
string
    Choices:
  • present ←
  • absent
Configures the intended state of the instance of the object on the NIOS server. When this value is set to present, the object is configured on the device and when this value is set to absent the value is removed (if necessary) from the device.
ttl
integer
Configures the TTL to be associated with this host record
view
string
Default:
"default"
Sets the DNS view to associate this host record with. The DNS view must already be configured on the system

aliases: dns_view

Notes

Note

  • This module must be run locally, which can be achieved by specifying connection: local.

  • Please read the Infoblox Guide for more detailed information on how to use Infoblox with Ansible.

Examples

- name: Configure an ipv4 host record
  community.general.nios_host_record:
    name: host.ansible.com
    ipv4:
      - address: 192.168.10.1
    aliases:
      - cname.ansible.com
    state: present
    provider:
      host: "{{ inventory_hostname_short }}"
      username: admin
      password: admin
  connection: local
- name: Add a comment to an existing host record
  community.general.nios_host_record:
    name: host.ansible.com
    ipv4:
      - address: 192.168.10.1
    comment: this is a test comment
    state: present
    provider:
      host: "{{ inventory_hostname_short }}"
      username: admin
      password: admin
  connection: local
- name: Remove a host record from the system
  community.general.nios_host_record:
    name: host.ansible.com
    state: absent
    provider:
      host: "{{ inventory_hostname_short }}"
      username: admin
      password: admin
  connection: local
- name: Update an ipv4 host record
  community.general.nios_host_record:
    name: {new_name: host-new.ansible.com, old_name: host.ansible.com}
    ipv4:
      - address: 192.168.10.1
    state: present
    provider:
      host: "{{ inventory_hostname_short }}"
      username: admin
      password: admin
  connection: local
- name: Create an ipv4 host record bypassing DNS
  community.general.nios_host_record:
    name: new_host
    ipv4:
      - address: 192.168.10.1
    dns: false
    state: present
    provider:
      host: "{{ inventory_hostname_short }}"
      username: admin
      password: admin
  connection: local
- name: Create an ipv4 host record over DHCP
  community.general.nios_host_record:
    name: host.ansible.com
    ipv4:
      - address: 192.168.10.1
        dhcp: true
        mac: 00-80-C8-E3-4C-BD
    state: present
    provider:
      host: "{{ inventory_hostname_short }}"
      username: admin
      password: admin
  connection: local
- name: Dynamically add host record to next available ip
  community.general.nios_host_record:
    name: host.ansible.com
    ipv4:
      - address: {nios_next_ip: 192.168.10.0/24}
    comment: this is a test comment
    state: present
    provider:
      host: "{{ inventory_hostname_short }}"
      username: admin
      password: admin
  connection: local
- name: Add ip to host record
  community.general.nios_host_record:
    name: host.ansible.com
    ipv4:
      - address: 192.168.10.2
        add: true
    state: present
    provider:
      host: "{{ inventory_hostname_short }}"
      username: admin
      password: admin
  connection: local
- name: Remove ip to host record
  community.general.nios_host_record:
    name: host.ansible.com
    ipv4:
      - address: 192.168.10.1
        remove: true
    state: absent
    provider:
      host: "{{ inventory_hostname_short }}"
      username: admin
      password: admin
  connection: local

Authors

  • Peter Sprygada (@privateip)