On this page
nsupdate - Manage DNS records.
New in version 2.3.
Synopsis
- Create, update and remove DNS records using DDNS updates
 - DDNS works well with both bind and Microsoft DNS (see https://technet.microsoft.com/en-us/library/cc961412.aspx)
 
Requirements
The below requirements are needed on the host that executes this module.
- dnspython
 
Parameters
| Parameter | Choices/Defaults | Comments | 
|---|---|---|
| key_algorithm | 
       
  | 
      
        
        Specify key algorithm used by  key_secret.
        | 
     
| key_name | 
        
        Use TSIG key name to authenticate against DNS  server
        | 
     |
| key_secret | 
        
        Use TSIG key secret, associated with  key_name, to authenticate against server
        | 
     |
| port  
        (added in 2.5)
         | 
      Default: 
        53
         | 
      
        
        Use this TCP port when connecting to  server.
        | 
     
| record  
        required
         | 
      
        
        Sets the DNS record to modify.
         | 
     |
| server  
        required
         | 
      
        
        Apply DNS modification on this server.
         | 
     |
| state | 
       
  | 
      
        
        Manage DNS record.
         | 
     
| ttl | Default: 
        3600
         | 
      
        
        Sets the record TTL.
         | 
     
| type | Default: 
        "A"
         | 
      
        
        Sets the record type.
         | 
     
| value | 
        
        Sets the record value.
         | 
     |
| zone  
        required
         | 
      
        
        DNS record will be modified on this  zone.
        | 
     
Examples
- name: Add or modify ansible.example.org A to 192.168.1.1"
  nsupdate:
    key_name: "nsupdate"
    key_secret: "+bFQtBCta7j2vWkjPkAFtgA=="
    server: "10.1.1.1"
    zone: "example.org"
    record: "ansible"
    value: "192.168.1.1"
- name: Add or modify ansible.example.org A to 192.168.1.1, 192.168.1.2 and 192.168.1.3"
  nsupdate:
    key_name: "nsupdate"
    key_secret: "+bFQtBCta7j2vWkjPkAFtgA=="
    server: "10.1.1.1"
    zone: "example.org"
    record: "ansible"
    value: ["192.168.1.1", "192.168.1.2", "192.168.1.3"]
- name: Remove puppet.example.org CNAME
  nsupdate:
    key_name: "nsupdate"
    key_secret: "+bFQtBCta7j2vWkjPkAFtgA=="
    server: "10.1.1.1"
    zone: "example.org"
    record: "puppet"
    type: "CNAME"
    state: absent
  Return Values
Common return values are documented here, the following are the fields unique to this module:
| Key | Returned | Description | 
|---|---|---|
| changed  
        string
         | 
      success | 
        
        If module has modified record
          | 
     
| dns_rc  
        int
         | 
      always | 
        
        dnspython return code
         Sample:
        
       
        4
         | 
     
| dns_rc_str  
        string
         | 
      always | 
        
        dnspython return code (string representation)
         Sample:
        
       
        REFUSED
         | 
     
| record  
        string
         | 
      success | 
        
        DNS record
         Sample:
        
       
        ansible
         | 
     
| ttl  
        int
         | 
      success | 
        
        DNS record TTL
         Sample:
        
       
        86400
         | 
     
| type  
        string
         | 
      success | 
        
        DNS record type
         Sample:
        
       
        CNAME
         | 
     
| value  
        list
         | 
      success | 
        
        DNS record value(s)
         Sample:
        
       
        192.168.1.1
         | 
     
| zone  
        string
         | 
      success | 
        
        DNS record zone
         Sample:
        
       
        example.org.
         | 
     
Status
This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.
Maintenance
This module is flagged as community which means that it is maintained by the Ansible Community. See Module Maintenance & Support for more info.
For a list of other modules that are also maintained by the Ansible Community, see here.
Author
- Loic Blot (@nerzhul)
 
Hint
If you notice any issues in this documentation you can edit this document to improve it.
© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
 https://docs.ansible.com/ansible/2.6/modules/nsupdate_module.html