community.general.nsupdate (8.5.0) — module

Manage DNS records

Authors: Loic Blot (@nerzhul)

Install collection

Install with ansible-galaxy collection install community.general:==8.5.0


Add to requirements.yml

  collections:
    - name: community.general
      version: 8.5.0

Description

Create, update and remove DNS records using DDNS updates


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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"]
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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

Inputs

    
ttl:
    default: 3600
    description:
    - Sets the record TTL.
    type: int

port:
    default: 53
    description:
    - Use this TCP port when connecting to O(server).
    type: int

type:
    default: A
    description:
    - Sets the record type.
    type: str

zone:
    description:
    - DNS record will be modified on this O(zone).
    - When omitted DNS will be queried to attempt finding the correct zone.
    type: str

state:
    choices:
    - present
    - absent
    default: present
    description:
    - Manage DNS record.
    type: str

value:
    description:
    - Sets the record value.
    elements: str
    type: list

record:
    description:
    - Sets the DNS record to modify. When zone is omitted this has to be absolute (ending
      with a dot).
    required: true
    type: str

server:
    description:
    - Apply DNS modification on this server, specified by IPv4 or IPv6 address.
    required: true
    type: str

key_name:
    description:
    - Use TSIG key name to authenticate against DNS O(server)
    type: str

protocol:
    choices:
    - tcp
    - udp
    default: tcp
    description:
    - Sets the transport protocol (TCP or UDP). TCP is the recommended and a more robust
      option.
    type: str

key_secret:
    description:
    - Use TSIG key secret, associated with O(key_name), to authenticate against O(server)
    type: str

key_algorithm:
    choices:
    - HMAC-MD5.SIG-ALG.REG.INT
    - hmac-md5
    - hmac-sha1
    - hmac-sha224
    - hmac-sha256
    - hmac-sha384
    - hmac-sha512
    default: hmac-md5
    description:
    - Specify key algorithm used by O(key_secret).
    type: str

Outputs

changed:
  description: If module has modified record
  returned: success
  type: str
dns_rc:
  description: dnspython return code
  returned: always
  sample: 4
  type: int
dns_rc_str:
  description: dnspython return code (string representation)
  returned: always
  sample: REFUSED
  type: str
record:
  description: DNS record
  returned: success
  sample: ansible
  type: str
ttl:
  description: DNS record TTL
  returned: success
  sample: 86400
  type: int
type:
  description: DNS record type
  returned: success
  sample: CNAME
  type: str
value:
  description: DNS record value(s)
  returned: success
  sample: 192.168.1.1
  type: list
zone:
  description: DNS record zone
  returned: success
  sample: example.org.
  type: str