---
title: "Host Record"
canonical: "https://docs.infoblox.com/space/niosmodulesansible/44624198/Host%20Record"
format: markdown
---
Use the `nios_host_record` module to create, update, or remove a host record object from a NIOS Grid.

The following table describes the parameters you can define in the `nios_host_record` module:

| **Parameter** | **Required/Optional** | **Description** |
| --- | --- | --- |
| `name` | Required | Specifies the fully qualified host name to add or remove from NIOS.  
To update the name of a host record object, define a dictionary object that contains the following parameters:<br>- `old_name`: Specifies the existing host name that must be changed.
- `new_name`: Specifies the new host name. |
| `view` | Optional | Specifies the DNS view to associate the host record with.  
If a value is not specified, the default DNS view configured in NIOS is used. |
| `configure_for_dns` | Optional | Sets the DNS to a particular parent. The default value is `true`. If you need to bypass the DNS, set the value to `false`. |
| `use_dns_ea_inheritance` | Optional | Specifies whether the extensible attribute must be inherited from the associated zone. The default value is `false`. To inherit the extensible attribute, set this value to `true`.  
Note: The `use_dns_ea_inheritance` parameter is compatible only with WAPI versions 2.12.3, 2.13.4, and later. |
| `ipv4addrs` | *Optional | Specifies the IPv4 address for the host record.<br>You can configure the following subparameters:<br>- `use_for_ea_inheritance`: Specifies whether the extensible attribute must be inherited from the host address. The default value is `false`.  
Note that when creating a host record, due to an known issue, this value is set to `true` by default. If you do not want the extensible attribute inherited, update this parameter to `false` in an update operation.
- `ipv4addr` (required): Specifies the IPv4 address for this host record.  
You can dynamically allocate an IPv4 address to the host record by passing a dictionary that contains `nios_next_ip` and `CIDR` network range.  
If you want to add or remove the IPv4 address from an existing record, use the parameters.
- `configure_for_dhcp`: Sets it to `true` to configure the host record over DHCP rather than DNS and then define the MAC address.
- `mac`: Specifies the hardware MAC address for the host record. You must specify this value if `configure_for_dhcp` is set to `true`.
- `add`: Specifies whether the IPv4 address must be added to an existing host record. Set it to `true` to add the IPv4 address.  
When adding an IPv4 address to the host record, you must set the value of the `state` parameter to `present` because the new IP address is allocated to the existing host record.
- `use_nextserver`: Specifies whether to use the `nextserver` option. Set it to `true` to enable the suer of `nextserver`.  
Note that to configure `use_nextserver` and `nextserver` options, the `configure_for_dhcp` option must be set to `true`.
- `nextserver`: Specifies the IPv4 address and/or the name in FQDN format of the next server that the host must boot from.
- `remove`: Specifies whether the IPv4 address must be removed from an existing host record. Set it to `true` to remove the IPv4 address.  
Set the `state` parameter to `absent` because the IP address is de-allocated from the host record. |
| `ipv6addrs` | *Optional | Specifies the IPv6 address for the host record. You can configure the following subparameters:<br>- `ipv6addr` (required): Specifies the IPv6 address for the host record.  
If you want to add or remove the IPv6 address from an existing record, use parameters.
- `configure_for_dhcp`: Determines whether the host record is configured over DHCP. Set it to `true` to configure the record over DHCP rather than DNS and then define the DUID.
- `duid`: Specifies the hardware DUID for the host record. You must specify this value if `configure_for_dhcp` is set to `true`. |
| `aliases` | Optional | Specifies an optional list of additional aliases to add to the host record.  
These are equivalent to CNAMEs but held within a host record. The value must be formatted as a list. |
| `ttl` | Optional | Specifies the Time To Live (TTL) value for the record.  
The duration that the record is valid for, in seconds (cached). |
| `extattrs` | Optional | Specifies extensible attributes for the host record object. |
| `state` | Optional | Specifies the state of the host record instance on the NIOS server.  
Set one of the following values:<br>- `present` (default): Configures the record.
- `absent`: Removes the record. |
| `comment` | Optional | Describes the host record object. |
| `provider` | Required | Defines the details of the connection:<br>- `host`: The DNS host name or IP address to connect to the remote instance of NIOS.
- `username`: The user name to use for authenticating the connection to the remote instance.
- `password`: The password to use for authenticating the connection to the remote instance.<br>For information on additional fields you can define, see <span style="color: #172b4d">the list of subparameters in the </span><span style="color: #172b4d">*[NIOS Modules for Ansible Collections](https://infoblox-docs.atlassian.net/wiki/spaces/niosmodulesansible/pages/44525470)*</span><span style="color: #172b4d"> topic.</span> |
| `connection` | Required | The `nios_host_record` module must be run locally. |

> ⚠️ **Note**
> ⚠️ 
> ⚠️ <span style="color: #0a3069">*When creating a host record, ensure that </span>`ipv4addrs`<span style="color: #0a3069">, </span>`ipv6addrs`<span style="color: #0a3069">, or both are specified.</span>

## <span style="color: #000000">Examples</span>

`name: configure an ipv4 host record`  
`infoblox.nios_modules.nios_host_record:`  
`  name: host.ansible.com`  
`  ipv4:`  
`    - address: 192.168.10.1`  
`  aliases:`  
`    - cname.ansible.com`  
`  state: present`  
`  provider:`  
`    host: <nios_hostname_or_hostip>`  
`    username: <nios_username>`  
`    password: <nios_password>`  
`connection: local`


`name: Create an ipv4 host record bypassing DNS`  
`infoblox.nios_modules.nios_host_record:`  
`  name: new_host`  
`  ipv4:`  
`    - address: 192.168.10.1`  
`  dns: false`  
`  state: present`  
`  provider:`  
`    host: <nios_hostname_or_hostip>`  
`    username: <nios_username>`  
`    password: <nios_password>`  
`connection: local`


`name: Create an ipv4 host record over DHCP`  
`infoblox.nios_modules.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: <nios_hostname_or_hostip>`  
`    username: <nios_username>`  
`    password: <nios_password>`  
`connection: local`


`name: Dynamically add host record to next available ip`  
`infoblox.nios_modules.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: <nios_hostname_or_hostip>`  
`    username: <nios_username>`  
`    password: <nios_password>`  
`connection: local`  
  
`name: Create an ipv4 host record with DNS EA inheritance enabled`  
`infoblox.nios_modules.nios_host_record:`  
`  name: host.ansible.com`  
`  configure_for_dns: true`  
`  use_dns_ea_inheritance: true`  
`  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: Create an ipv4 host record with host address EA inheritance enabled`  
`infoblox.nios_modules.nios_host_record:`  
`  name: host.ansible.com`  
`  configure_for_dns: true`  
`  ipv4:`  
`    - address: 192.168.10.1`  
`      dhcp: true`  
`      mac: 00-80-C8-E3-4C-BD`  
`      use_for_ea_inheritance: true`  
`  state: present`  
`  provider:`  
`    host: "{{ inventory_hostname_short }}"`  
`    username: admin`  
`    password: admin`  
`connection: local`  


`name: Create an ipv4 host record over DHCP with PXE server`  
`infoblox.nios_modules.nios_host_record:`  
`  name: host.ansible.com`  
`  ipv4:`  
`    - address: 192.168.10.1`  
`      dhcp: true`  
`      mac: 00-80-C8-E3-4C-BD`  
`      use_nextserver: true`  
`      nextserver: pxe-server.com`  
`  state: present`  
`  provider:`  
`    host: "{{ inventory_hostname_short }}"`  
`    username: admin`  
`    password: admin`  
`connection: local`  


`name: Update an ipv4 host record`  
`infoblox.nios_modules.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: <nios_hostname_or_hostip>`  
`    username: <nios_username>`  
`    password: <nios_password>`  
`connection: local`  


`name: Create host record with IPv4 and IPv6 addresses`  
`infoblox.nios_modules.nios_host_record:`  
`  name: hostrec.ansible.com`  
`  ipv4:`  
`    - address: 192.168.10.7`  
`      mac: 12:80:C8:E3:4C:AB`  
`  ipv6:`  
`    - address: fe80::10`  
`      duid: 12:80:C8:E3:4C:B4`  
`  state: present`  
`  provider:`  
`    host: <nios_hostname_or_hostip>`  
`    username: <nios_username>`  
`    password: <nios_password>`  
`connection: local`