noderings.cloud.dns_record module – Manage DNS records in a NodeRings zone

Note

This module is part of the noderings.cloud collection (version 0.2.0).

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 noderings.cloud. You need further requirements to be able to use this module, see Requirements for details.

To use it in a playbook, specify: noderings.cloud.dns_record.

New in noderings.cloud 0.1.0

Synopsis

  • Manages one record set (RRset) in a NodeRings DNS zone, that is all values for one name and type.

  • With state=present the record set is made to hold exactly values, unless append=true.

Requirements

The below requirements are needed on the host that executes this module.

  • python >= 3.9

Parameters

Parameter

Comments

api_retries

integer

How many times a request is retried after rate limiting (HTTP 429) or a gateway error (HTTP 502, 503 or 504).

Orders (virtual machines, game servers, snapshots) are never retried blindly.

Default: 5

api_timeout

integer

Timeout in seconds for a single HTTP request.

Default: 60

api_token

aliases: token

string

A NodeRings service-account token.

Create one in the NodeRings console under Organization > Service accounts.

If not set, the value of the NODERINGS_TOKEN, NODERINGS_API_TOKEN or NR_API_TOKEN environment variable is used.

api_url

string

Base URL of the NodeRings API.

If not set, the value of the NODERINGS_API_URL environment variable is used.

Default: "https://api.noderings.com"

append

boolean

With state=present, add values to the record set instead of replacing it.

With state=absent, remove only values from the record set instead of deleting it.

Choices:

  • false ← (default)

  • true

name

string / required

Record name relative to the zone, for example www. Use @ for the zone apex.

A fully qualified name inside the zone, such as www.example.com, also works.

organization_id

string

Organization to act in, sent as the X-Organization-ID header.

Defaults to the organization the token belongs to.

If not set, the value of the NODERINGS_ORGANIZATION_ID or NR_ORGANIZATION_ID environment variable is used.

state

string

Whether the record set should exist.

Choices:

  • "present" ← (default)

  • "absent"

ttl

integer

Time to live in seconds.

Default: 3600

type

string / required

Record type.

Choices:

  • "A"

  • "AAAA"

  • "ALIAS"

  • "CAA"

  • "CERT"

  • "CNAME"

  • "DNAME"

  • "DS"

  • "HINFO"

  • "HTTPS"

  • "LOC"

  • "MX"

  • "NAPTR"

  • "NS"

  • "OPENPGPKEY"

  • "PTR"

  • "RP"

  • "SMIMEA"

  • "SRV"

  • "SSHFP"

  • "SVCB"

  • "TLSA"

  • "TXT"

validate_certs

boolean

Whether to validate the API’s TLS certificate.

Choices:

  • false

  • true ← (default)

values

aliases: value, records

list / elements=string

The record values. Required when state=present.

Hostnames should end with a dot, for example 10 mail.example.com. for MX.

Write TXT values unquoted; long values are split into 255-byte strings for you.

zone

string

Name of the zone, for example example.com. Either zone or zone_id is required.

zone_id

string

ID of the zone.

Attributes

Attribute

Support

Description

check_mode

Support: full

Can run in check_mode and return changed status prediction without modifying the target.

diff_mode

Support: full

Will return details on what has changed (or possibly needs changing in check_mode), when in diff mode.

Notes

Note

  • All modules in this collection belong to the noderings.cloud.noderings action group, so connection options can be set once with module_defaults.

Examples

- name: Point www at a server
  noderings.cloud.dns_record:
    zone: example.com
    name: www
    type: A
    ttl: 300
    values: ["{{ vm.virtual_machine.ipv4 }}"]

- name: Mail for the apex
  noderings.cloud.dns_record:
    zone: example.com
    name: "@"
    type: MX
    values:
      - "10 mail1.example.com."
      - "20 mail2.example.com."

- name: Add one more SPF include without touching other TXT values
  noderings.cloud.dns_record:
    zone: example.com
    name: "@"
    type: TXT
    values: ["google-site-verification=abc123"]
    append: true

- name: Remove a record set
  noderings.cloud.dns_record:
    zone: example.com
    name: old
    type: CNAME
    state: absent

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key

Description

record

dictionary

The record set as stored. Empty after it is deleted.

Returned: always

Sample: {"name": "www", "ttl": 300, "type": "A", "values": ["203.0.113.10"], "zone_id": "0f3c7b9e-1111-4c4c-8a8a-123456789abc"}

Authors

  • Shaygun (@shaygun)