---
title: "DNS Zone"
canonical: "https://docs.infoblox.com/space/niosmodulesansible/45875413/DNS%20Zone"
format: markdown
---
<span style="color: #000000">Use the </span>`nios_zone`<span style="color: #000000"> module to create, update, or remove a DNS zone object from a NIOS Grid.</span>

<span style="color: #000000">The following table describes the parameters you can define in the </span>`nios_zone`<span style="color: #000000"> module:</span>

| <span style="color: #000000">**Parameter**</span> | <span style="color: #000000">**Required/Optional**</span> | <span style="color: #000000">**Description**</span> |
| --- | --- | --- |
| `name/fqdn` | <span style="color: #000000">Required</span> | <span style="color: #000000">Specifies the fully qualified host name to add, update, or remove from NIOS.</span> |
| `view` | <span style="color: #000000">Optional</span> | <span style="color: #000000">Specifies the DNS view to associate the zone with.</span>  
<span style="color: #000000">If a value is not specified, the default view configured in NIOS is used.</span> |
| `grid_primary` | <span style="color: #000000">Optional</span> | <span style="color: #000000">Specifies the primary server of the Grid for this zone. Configure the </span>`name`<span style="color: #000000"> of the Grid primary server as the subparameter.</span> |
| `grid_secondaries` | <span style="color: #000000">Optional</span> | <span style="color: #000000">Specifies the secondary server of the Grid for this zone. Configure the </span>`name`<span style="color: #000000"> of the Grid secondary server as the subparameter.</span> |
| `ns_group` | <span style="color: #000000">Optional</span> | <span style="color: #000000">Specifies the name server group for this zone.</span>  
<span style="color: #000000">The name server group is mutually exclusive with the primary and secondary servers of the Grid.</span> |
| `restart_if_needed` | <span style="color: #000000">Optional</span> | <span style="color: #000000">Setting this parameter to </span>`true`<span style="color: #000000">, causes the NIOS DNS service to restart and load the new zone configuration.</span> |
| `zone_format` | <span style="color: #000000">Optional</span> | <span style="color: #000000">Creates an authoritative reverse-mapping zone, which is an area of the network space for which one or more primary and secondary name servers respond to the address-to-name queries.</span>  
<span style="color: #000000">It supports reverse-mapping zones for IPv4 as well as IPv6 addresses. The default value is </span>`FORWARD`<span style="color: #000000">.</span> |
| `extattrs` | <span style="color: #000000">Optional</span> | <span style="color: #000000">Specifies extensible attributes for the zone object.</span> |
| `state` | <span style="color: #000000">Optional</span> | <span style="color: #000000">Specifies the state of the DNS zone instance on the NIOS server.</span>  
<span style="color: #000000">Set one of the following values:</span><br>- `present`<span style="color: #000000"> (default): Configures the record.</span>
- `absent`<span style="color: #000000">: Removes the record.</span> |
| `comment` | <span style="color: #000000">Optional</span> | <span style="color: #000000">Describes the DNS zone object.</span> |
| `provider` | <span style="color: #000000">Required</span> | <span style="color: #000000">Defines the details of the connection:</span><br>- `host`<span style="color: #000000">: The DNS host name or IP address to connect to the remote instance of NIOS.</span>
- `username`<span style="color: #000000">: The user name to use for authenticating the connection to the remote instance.</span>
- `password`<span style="color: #000000">: The password to use for authenticating the connection to the remote instance.</span><br><span style="color: #000000">For information on additional fields you can define, see </span>the list of subparameters in the *[NIOS Modules for Ansible Collections](https://infoblox-docs.atlassian.net/wiki/spaces/niosmodulesansible/pages/44525470)* topic. |
| `connection` | <span style="color: #000000">Required</span> | <span style="color: #000000">The </span>`nios_zone`<span style="color: #000000"> module must be run locally.</span> |

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

`name:Configure a zone on the system using grid primary and secondaries`  
`infoblox.nios_modules.nios_zone:`  
`  name: ansible.com`  
`  grid_primary:`  
`   - name: gridprimary.grid.com`  
`  grid_secondaries:`  
`   - name: gridsecondary1.grid.com`  
`   - name: gridsecondary2.grid.com`  
`  restart_if_needed: true  `  
`  state: present`  
`  provider:`  
`    host: <nios_hostname_or_hostip>`  
`    username: <nios_username>`  
`    password: <nios_password>`  
`connection: local`


`name:Configure a zone on the system using a name server group`  
`infoblox.nios_modules.nios_zone:`  
`  name: ansible.com`  
`  ns_group: examplensg`  
`  restart_if_needed: true  `  
`  state: present`  
`  provider:`  
`    host: <nios_hostname_or_hostip>`  
`    username: <nios_username>`  
`    password: <nios_password>`  
`connection: local`