community.general.nsupdate module – Manage DNS records.
Note
This module is part of the community.general collection (version 4.8.3).
You might already have this collection installed if you are using the ansible
package.
It is not included in ansible-core
.
To check whether it is installed, run ansible-galaxy collection list
.
To install it, use: ansible-galaxy collection install community.general
.
To use it in a playbook, specify: community.general.nsupdate
.
Parameters
Parameter |
Comments |
---|---|
Specify key algorithm used by Choices:
|
|
Use TSIG key name to authenticate against DNS |
|
Use TSIG key secret, associated with |
|
Use this TCP port when connecting to Default: 53 |
|
Sets the transport protocol (TCP or UDP). TCP is the recommended and a more robust option. Choices:
|
|
Sets the DNS record to modify. When zone is omitted this has to be absolute (ending with a dot). |
|
Apply DNS modification on this server, specified by IPv4 or IPv6 address. |
|
Manage DNS record. Choices:
|
|
Sets the record TTL. Default: 3600 |
|
Sets the record type. Default: “A” |
|
Sets the record value. |
|
DNS record will be modified on this When omitted DNS will be queried to attempt finding the correct zone. Starting with Ansible 2.7 this parameter is optional. |
Examples
- name: Add or modify ansible.example.org A to 192.168.1.1"
community.general.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"
community.general.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
community.general.nsupdate:
key_name: "nsupdate"
key_secret: "+bFQtBCta7j2vWkjPkAFtgA=="
server: "10.1.1.1"
zone: "example.org"
record: "puppet"
type: "CNAME"
state: absent
- name: Add 1.1.168.192.in-addr.arpa. PTR for ansible.example.org
community.general.nsupdate:
key_name: "nsupdate"
key_secret: "+bFQtBCta7j2vWkjPkAFtgA=="
server: "10.1.1.1"
record: "1.1.168.192.in-addr.arpa."
type: "PTR"
value: "ansible.example.org."
state: present
- name: Remove 1.1.168.192.in-addr.arpa. PTR
community.general.nsupdate:
key_name: "nsupdate"
key_secret: "+bFQtBCta7j2vWkjPkAFtgA=="
server: "10.1.1.1"
record: "1.1.168.192.in-addr.arpa."
type: "PTR"
state: absent
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
If module has modified record Returned: success |
|
dnspython return code Returned: always Sample: 4 |
|
dnspython return code (string representation) Returned: always Sample: “REFUSED” |
|
DNS record Returned: success Sample: “ansible” |
|
DNS record TTL Returned: success Sample: 86400 |
|
DNS record type Returned: success Sample: “CNAME” |
|
DNS record value(s) Returned: success Sample: “192.168.1.1” |
|
DNS record zone Returned: success Sample: “example.org.” |
Authors
Loic Blot (@nerzhul)
Collection links
Issue Tracker Repository (Sources) Submit a bug report Request a feature Communication