community.general.netcup_dns 模块 – 管理 Netcup DNS 记录

注意

此模块是 community.general 集合(版本 10.1.0)的一部分。

如果您正在使用 ansible 包,则可能已经安装了此集合。 它不包含在 ansible-core 中。 要检查是否已安装,请运行 ansible-galaxy collection list

要安装它,请使用:ansible-galaxy collection install community.general。 您需要其他要求才能使用此模块,请参阅 要求 了解详细信息。

要在 playbook 中使用它,请指定:community.general.netcup_dns

概要

要求

执行此模块的主机需要满足以下要求。

  • nc-dnsapi >= 0.1.3

参数

参数

注释

api_key

字符串 / 必需

用于身份验证的 API 密钥,必须通过 netcup CCP 获取(https://ccp.netcup.net)。

api_password

字符串 / 必需

用于身份验证的 API 密码,必须通过 netcup CCP 获取(https://ccp.netcup.net)。

customer_id

整数 / 必需

Netcup 客户 ID。

domain

字符串 / 必需

应添加/删除记录的域名。

priority

整数

记录优先级。 对于 type=MX 是必需的。

record

别名: name

字符串

要添加或删除的记录,支持通配符(*)。 默认值为 @(即区域名称)。

默认值: "@"

solo

布尔值

该记录是否应是该记录类型和记录名称的唯一记录。 仅与 state=present 一起使用。

这将删除所有其他具有相同记录名称和类型的记录。

选择

  • false ← (默认)

  • true

state

字符串

记录是否应存在。

选择

  • "present" ← (默认)

  • "absent"

timeout

整数

在 community.general 5.7.0 中添加

HTTP(S) 连接超时(以秒为单位)。

默认值: 5

type

字符串 / 必需

记录类型。

在 community.general 8.1.0 中添加了对 OPENPGPKEYSMIMEASSHFP 的支持。

记录类型 OPENPGPKEYSMIMEA 需要 nc-dnsapi >= 0.1.5。

记录类型 SSHFP 需要 nc-dnsapi >= 0.1.6。

选择

  • "A"

  • "AAAA"

  • "MX"

  • "CNAME"

  • "CAA"

  • "SRV"

  • "TXT"

  • "TLSA"

  • "NS"

  • "DS"

  • "OPENPGPKEY"

  • "SMIMEA"

  • "SSHFP"

value

字符串 / 必需

记录值。

属性

属性

支持

描述

check_mode

支持: 完整

可以在 check_mode 中运行,并在不修改目标的情况下返回更改状态预测。

diff_mode

支持:

当处于 diff 模式时,将返回有关已更改(或可能需要在 check_mode 中更改)的内容的详细信息。

示例

- 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

返回值

常见返回值记录在此处,以下是此模块特有的字段

描述

records

复杂

包含所有记录的列表

返回值: 成功

id

整数

记录的内部 ID

返回值: 成功

示例: 12345

名称

字符串

记录名称

返回值: 成功

示例: "fancy-hostname"

priority

整数

记录优先级(仅当 type=MX 时相关)

返回值: 成功

示例: 0

type

字符串

记录类型

返回值: 成功

示例: "A"

value

字符串

记录目标

返回值: 成功

示例: "127.0.0.1"

作者

  • Nicolai Buchwitz (@nbuchwitz)