community.general.netcup_dns module – Manage Netcup DNS records

Note

This module is part of the community.general collection (version 8.6.8).

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

To use it in a playbook, specify: community.general.netcup_dns.

Synopsis

Aliases: net_tools.netcup_dns

Requirements

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

  • nc-dnsapi >= 0.1.3

Parameters

Parameter

Comments

api_key

string / required

API key for authentication, must be obtained via the netcup CCP (https://ccp.netcup.net).

api_password

string / required

API password for authentication, must be obtained via the netcup CCP (https://ccp.netcup.net).

customer_id

integer / required

Netcup customer id.

domain

string / required

Domainname the records should be added / removed.

priority

integer

Record priority. Required for type=MX.

record

aliases: name

string

Record to add or delete, supports wildcard (*). Default is @ (that is, the zone name).

Default: "@"

solo

boolean

Whether the record should be the only one for that record type and record name. Only use with state=present.

This will delete all other records with the same record name and type.

Choices:

  • false ← (default)

  • true

state

string

Whether the record should exist or not.

Choices:

  • "present" ← (default)

  • "absent"

timeout

integer

added in community.general 5.7.0

HTTP(S) connection timeout in seconds.

Default: 5

type

string / required

Record type.

Support for OPENPGPKEY, SMIMEA and SSHFP was added in community.general 8.1.0.

Record types OPENPGPKEY and SMIMEA require nc-dnsapi >= 0.1.5.

Record type SSHFP requires nc-dnsapi >= 0.1.6.

Choices:

  • "A"

  • "AAAA"

  • "MX"

  • "CNAME"

  • "CAA"

  • "SRV"

  • "TXT"

  • "TLSA"

  • "NS"

  • "DS"

  • "OPENPGPKEY"

  • "SMIMEA"

  • "SSHFP"

value

string / required

Record value.

Attributes

Attribute

Support

Description

check_mode

Support: full

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

diff_mode

Support: none

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

Examples

- name: Create a record of type A
  community.general.netcup_dns:
    api_key: "..."
    api_password: "..."
    customer_id: "..."
    domain: "example.com"
    name: "mail"
    type: "A"
    value: "127.0.0.1"

- name: Delete that record
  community.general.netcup_dns:
    api_key: "..."
    api_password: "..."
    customer_id: "..."
    domain: "example.com"
    name: "mail"
    type: "A"
    value: "127.0.0.1"
    state: absent

- name: Create a wildcard record
  community.general.netcup_dns:
    api_key: "..."
    api_password: "..."
    customer_id: "..."
    domain: "example.com"
    name: "*"
    type: "A"
    value: "127.0.1.1"

- name: Set the MX record for example.com
  community.general.netcup_dns:
    api_key: "..."
    api_password: "..."
    customer_id: "..."
    domain: "example.com"
    type: "MX"
    value: "mail.example.com"

- name: Set a record and ensure that this is the only one
  community.general.netcup_dns:
    api_key: "..."
    api_password: "..."
    customer_id: "..."
    name: "demo"
    domain: "example.com"
    type: "AAAA"
    value: "::1"
    solo: true

- name: Increase the connection timeout to avoid problems with an unstable connection
  community.general.netcup_dns:
    api_key: "..."
    api_password: "..."
    customer_id: "..."
    domain: "example.com"
    name: "mail"
    type: "A"
    value: "127.0.0.1"
    timeout: 30

Return Values

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

Key

Description

records

complex

list containing all records

Returned: success

id

integer

internal id of the record

Returned: success

Sample: 12345

name

string

the record name

Returned: success

Sample: "fancy-hostname"

priority

integer

the record priority (only relevant if type=MX)

Returned: success

Sample: 0

type

string

the record type

Returned: success

Sample: "A"

value

string

the record destination

Returned: success

Sample: "127.0.0.1"

Authors

  • Nicolai Buchwitz (@nbuchwitz)