community.general.dnsmadeeasy 模块 – 与 dnsmadeeasy.com(DNS 托管服务)接口
注意
此模块是 community.general 集合(版本 10.1.0)的一部分。
如果您使用的是 ansible
包,您可能已经安装了这个集合。它不包含在 ansible-core
中。要检查是否已安装,请运行 ansible-galaxy collection list
。
要安装它,请使用:ansible-galaxy collection install community.general
。您需要进一步的要求才能使用此模块,请参阅 要求 了解详细信息。
要在 playbook 中使用它,请指定:community.general.dnsmadeeasy
。
概要
通过 DNS Made Easy 服务的 v2 REST API 管理 DNS 记录。它仅处理记录;目前尚不支持对域或监视器/帐户进行操作。请参阅:https://www.dnsmadeeasy.com/integration/restapi/
要求
执行此模块的主机上需要满足以下要求。
hashlib
hmac
参数
参数 |
注释 |
---|---|
帐户 API 密钥。 |
|
帐户密钥。 |
|
如果为 true,则在故障转移后手动回退到主 IP 地址。 如果为 false,则在故障转移后自动回退到主 IP 地址。 选择
|
|
监视器将通知的联系人列表的名称或 ID。 默认的 |
|
要使用的域。可以是域名(例如“mydomain.com”)或 DNS Made Easy 中域的数字 ID(例如“839989”),以便更快地解析 |
|
如果 选择
|
|
监视器为 HTTP 或 HTTPS 查询的 Fqdn 上的文件。 |
|
监视器使用的完全限定域名。 |
|
监视器为 HTTP 或 HTTPS 查询的 httpFile 中的字符串。 |
|
故障转移的主 IP 地址。 如果添加或更改监视器或故障转移,则为必需。 |
|
故障转移的辅助 IP 地址。 如果添加或更改故障转移,则为必需。 |
|
故障转移的第三个 IP 地址。 |
|
故障转移的第四个 IP 地址。 |
|
故障转移的第五个 IP 地址。 |
|
监视器发送给联系人列表的电子邮件数量。 默认值: |
|
如果 选择
|
|
监视器使用的端口。 默认值: |
|
监视器使用的协议。 选择
|
|
要获取/创建/删除/更新的记录名称。如果未指定 record_name;无论 state 参数如何,“result”中将返回该域的所有记录。 |
|
记录的“生存时间”。记录在 DNS 服务器中缓存的秒数。 默认值: |
|
记录类型。 选择
|
|
记录值。HTTPRED:<重定向 URL>,MX:<优先级> <目标名称>,NS:<名称服务器>,PTR:<目标名称>,SRV:<优先级> <权重> <端口> <目标名称>,TXT:<文本值>” 如果未指定 record_value;则不会进行任何更改,记录将返回到“result”中(换句话说,此模块可用于获取记录的当前 ID、类型和 TTL) |
|
确定是否应使用沙盒 API。否则(默认情况下)使用 DNS Made Easy 的生产 API。 选择
|
|
监视器在发生故障转移之前执行的检查次数,其中低 = 8,中 = 5,高 = 3。 选择
|
|
记录是否应存在 选择
|
|
监视器使用的描述。 默认值: |
|
如果 选择
|
属性
属性 |
支持 |
描述 |
---|---|---|
支持: 无 |
可以在 |
|
支持: 无 |
当处于 diff 模式时,将返回有关已更改的内容(或可能需要在 |
注释
注意
DNS Made Easy 服务要求与 API 交互的机器设置正确的时间和时区。请务必使用 NTP 将您的时间保持在实际时间的几秒钟内。
当 ‘state’ 设置为 ‘present’ 时,此模块会在 “result” 元素中返回记录和监视器。这些值可以注册并在您的 playbook 中使用。
只有 A 记录可以有监视器或故障转移。
要添加故障转移,需要 ‘failover’、‘autoFailover’、‘port’、‘protocol’、‘ip1’ 和 ‘ip2’ 选项。
要添加监视器,需要 ‘monitor’、‘port’、‘protocol’、‘maxEmails’、‘systemDescription’ 和 ‘ip1’ 选项。
监视器和故障转移将共享 ‘port’、‘protocol’ 和 ‘ip1’ 选项。
示例
- name: Fetch my.com domain records
community.general.dnsmadeeasy:
account_key: key
account_secret: secret
domain: my.com
state: present
register: response
- name: Create a record
community.general.dnsmadeeasy:
account_key: key
account_secret: secret
domain: my.com
state: present
record_name: test
record_type: A
record_value: 127.0.0.1
- name: Update the previously created record
community.general.dnsmadeeasy:
account_key: key
account_secret: secret
domain: my.com
state: present
record_name: test
record_value: 192.0.2.23
- name: Fetch a specific record
community.general.dnsmadeeasy:
account_key: key
account_secret: secret
domain: my.com
state: present
record_name: test
register: response
- name: Delete a record
community.general.dnsmadeeasy:
account_key: key
account_secret: secret
domain: my.com
record_type: A
state: absent
record_name: test
- name: Add a failover
community.general.dnsmadeeasy:
account_key: key
account_secret: secret
domain: my.com
state: present
record_name: test
record_type: A
record_value: 127.0.0.1
failover: true
ip1: 127.0.0.2
ip2: 127.0.0.3
- name: Add a failover
community.general.dnsmadeeasy:
account_key: key
account_secret: secret
domain: my.com
state: present
record_name: test
record_type: A
record_value: 127.0.0.1
failover: true
ip1: 127.0.0.2
ip2: 127.0.0.3
ip3: 127.0.0.4
ip4: 127.0.0.5
ip5: 127.0.0.6
- name: Add a monitor
community.general.dnsmadeeasy:
account_key: key
account_secret: secret
domain: my.com
state: present
record_name: test
record_type: A
record_value: 127.0.0.1
monitor: true
ip1: 127.0.0.2
protocol: HTTP # default
port: 80 # default
maxEmails: 1
systemDescription: Monitor Test A record
contactList: my contact list
- name: Add a monitor with http options
community.general.dnsmadeeasy:
account_key: key
account_secret: secret
domain: my.com
state: present
record_name: test
record_type: A
record_value: 127.0.0.1
monitor: true
ip1: 127.0.0.2
protocol: HTTP # default
port: 80 # default
maxEmails: 1
systemDescription: Monitor Test A record
contactList: 1174 # contact list id
httpFqdn: http://my.com
httpFile: example
httpQueryString: some string
- name: Add a monitor and a failover
community.general.dnsmadeeasy:
account_key: key
account_secret: secret
domain: my.com
state: present
record_name: test
record_type: A
record_value: 127.0.0.1
failover: true
ip1: 127.0.0.2
ip2: 127.0.0.3
monitor: true
protocol: HTTPS
port: 443
maxEmails: 1
systemDescription: monitoring my.com status
contactList: emergencycontacts
- name: Remove a failover
community.general.dnsmadeeasy:
account_key: key
account_secret: secret
domain: my.com
state: present
record_name: test
record_type: A
record_value: 127.0.0.1
failover: false
- name: Remove a monitor
community.general.dnsmadeeasy:
account_key: key
account_secret: secret
domain: my.com
state: present
record_name: test
record_type: A
record_value: 127.0.0.1
monitor: false