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

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

| **Parameter** | **Required/Optional** | **Description** |
| --- | --- | --- |
| `name` | Required | Specifies the fully qualified host name to add or remove from NIOS.<br>To update the name of a CNAME record object, define a dictionary object that contains the following parameters:<br>- `old_name`: Specifies the existing name that must be changed.
- `new_name`: Specifies the new name. |
| `canonical` | Required | Specifies the canonical name of the CNAME record. |
| `view` | Optional | Specifies the DNS view to associate the CNAME record with.  
If a value is not specified, the default view configured in NIOS is used. |
| `ttl` | Optional | Specifies the Time To Live (TTL) value for the record.  
<span style="color: #000000">The duration that the record is valid for, in seconds (cached).</span> |
| `extattrs` | Optional | Specifies the extensible attributes for the CNAME record object. |
| `state` | Optional | Specifies the state of the CNAME 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 CNAME record object. |
| `provider` | Required | Defines the details of the connection:<br>- `host`: DNS host name or IP address to connect to the remote instance of NIOS.
- `username`: User name to use for authenticating the connection to the remote instance.
- `password`: Password to use for authenticating the connection to the remote instance.<br>For information on additional fields you can define, see <span style="color: #000000">the list of subparameters in the </span><span style="color: #000000">*[NIOS Modules for Ansible Collections](https://infoblox-docs.atlassian.net/wiki/spaces/niosmodulesansible/pages/44525470/NIOS+Modules+for+Ansible+Collections#Providerparameters)*</span><span style="color: #000000"> topic</span><span style="color: #ff0000">.</span> |
| `connection` | Required | The `nios_cname_record` module must be run locally. |

  


## Examples

`name: configure a CNAME record`  
`infoblox.nios_modules.nios_cname_record:`  
`  name: cname.ansibletestzone.com`  
`  canonical: realhost.ansible.com`  
`  state: present`  
`  provider:`  
`    host: <nios_hostname_or_hostip>`  
`    username: <nios_username>`  
`    password: <nios_password>`  
`connection: local`  


`name: add a comment to an existing CNAME record`  
`infoblox.nios_modules.nios_cname_record:`  
`  name: cname.ansibletestzone.com`  
`  canonical: realhost.ansible.com`  
`  comment: this is a test comment`  
`  state: present`  
`  provider:`  
`    host: <nios_hostname_or_hostip>`  
`    username: <nios_username>`  
`    password: <nios_password>`  
`connection: local`  
  
`name: Update the name of a CNAME record`  
`infoblox.nios_modules.nios_cname_record:`  
`  name: {old_name: cname.ansibletestzone.com, new_name: demo.ansibletestzone.com}`  
`  canonical: realhost.ansible.com`  
`  state: present`  
`  provider:`  
`    host: <nios_hostname_or_hostip>`  
`    username: <nios_username>`  
`    password: <nios_password>`  
`connection: local`