community / community.dns / 1.2.3 / module / hosttech_dns_record Add or delete entries in Hosttech DNS service | "added in version" 0.1.0 of community.dns" Authors: Felix Fontein (@felixfontein)community.dns.hosttech_dns_record (1.2.3) — module
Install with ansible-galaxy collection install community.dns:==1.2.3
collections: - name: community.dns version: 1.2.3
Creates and deletes DNS records in Hosttech DNS service.
- name: Add new.foo.com as an A record with 3 IPs community.dns.hosttech_dns_record: state: present zone: foo.com record: new.foo.com type: A ttl: 7200 value: 1.1.1.1,2.2.2.2,3.3.3.3 hosttech_token: access_token
- name: Update new.foo.com as an A record with a list of 3 IPs community.dns.hosttech_dns_record: state: present zone: foo.com record: new.foo.com type: A ttl: 7200 value: - 1.1.1.1 - 2.2.2.2 - 3.3.3.3 hosttech_token: access_token
- name: Retrieve the details for new.foo.com community.dns.hosttech_dns_record_info: zone: foo.com record: new.foo.com type: A hosttech_username: foo hosttech_password: bar register: rec
- name: Delete new.foo.com A record using the results from the facts retrieval command community.dns.hosttech_dns_record: state: absent zone: foo.com record: "{{ rec.set.record }}" ttl: "{{ rec.set.ttl }}" type: "{{ rec.set.type }}" value: "{{ rec.set.value }}" hosttech_username: foo hosttech_password: bar
- name: Add an AAAA record # Note that because there are colons in the value that the IPv6 address must be quoted! community.dns.hosttech_dns_record: state: present zone: foo.com record: localhost.foo.com type: AAAA ttl: 7200 value: "::1" hosttech_token: access_token
- name: Add a TXT record community.dns.hosttech_dns_record: state: present zone: foo.com record: localhost.foo.com type: TXT ttl: 7200 value: 'bar' hosttech_username: foo hosttech_password: bar
- name: Remove the TXT record community.dns.hosttech_dns_record: state: absent zone: foo.com record: localhost.foo.com type: TXT ttl: 7200 value: 'bar' hosttech_username: foo hosttech_password: bar
- name: Add a CAA record community.dns.hosttech_dns_record: state: present zone: foo.com record: foo.com type: CAA ttl: 3600 value: - "128 issue letsencrypt.org" - "128 iodef mailto:webmaster@foo.com" hosttech_token: access_token
- name: Add an MX record community.dns.hosttech_dns_record: state: present zone: foo.com record: foo.com type: MX ttl: 3600 value: - "10 mail.foo.com" hosttech_token: access_token
- name: Add a CNAME record community.dns.hosttech_dns_record: state: present zone: bla.foo.com record: foo.com type: CNAME ttl: 3600 value: - foo.foo.com hosttech_username: foo hosttech_password: bar
- name: Add a PTR record community.dns.hosttech_dns_record: state: present zone: foo.foo.com record: foo.com type: PTR ttl: 3600 value: - foo.foo.com hosttech_token: access_token
- name: Add an SPF record community.dns.hosttech_dns_record: state: present zone: foo.com record: foo.com type: SPF ttl: 3600 value: - "v=spf1 a mx ~all" hosttech_username: foo hosttech_password: bar
- name: Add a PTR record community.dns.hosttech_dns_record: state: present zone: foo.com record: foo.com type: PTR ttl: 3600 value: - "10 100 3333 service.foo.com" hosttech_token: access_token
ttl: default: 3600 description: - The TTL to give the new record, in seconds. type: int type: choices: - A - CNAME - MX - AAAA - TXT - PTR - SRV - SPF - NS - CAA description: - The type of DNS record to create or delete. required: true type: str zone: description: - The DNS zone to modify. - Exactly one of I(zone) and I(zone_id) must be specified. type: str state: choices: - present - absent description: - Specifies the state of the resource record. required: true type: str value: description: - The new value when creating a DNS record. - YAML lists or multiple comma-spaced values are allowed. - When deleting a record all values for the record must be specified or it will not be deleted. elements: str required: true type: list prefix: description: - The prefix of the DNS record. - This is the part of I(record) before I(zone). For example, if the record to be modified is C(www.example.com) for the zone C(example.com), the prefix is C(www). If the record in this example would be C(example.com), the prefix would be C('') (empty string). - Exactly one of I(record) and I(prefix) must be specified. type: str version_added: 0.2.0 version_added_collection: community.dns record: description: - The full DNS record to create or delete. - Exactly one of I(record) and I(prefix) must be specified. type: str zone_id: description: - The ID of the DNS zone to modify. - Exactly one of I(zone) and I(zone_id) must be specified. type: int version_added: 0.2.0 version_added_collection: community.dns overwrite: default: false description: - If I(state=present), whether an existing record should be overwritten on create if values do not match. - If I(state=absent), whether existing records should be deleted if values do not match. type: bool hosttech_token: aliases: - api_token description: - The password for the Hosttech API user. - Mutually exclusive with I(hosttech_username) and I(hosttech_password). - Since community.dns 1.2.0, the alias I(api_token) can be used. type: str version_added: 0.2.0 version_added_collection: community.dns hosttech_password: description: - The password for the Hosttech API user. - If provided, I(hosttech_username) must also be provided. - Mutually exclusive with I(hosttech_token). type: str hosttech_username: description: - The username for the Hosttech API user. - If provided, I(hosttech_password) must also be provided. - Mutually exclusive with I(hosttech_token). type: str
zone_id: description: The ID of the zone. returned: success sample: 23 type: int version_added: 0.2.0 version_added_collection: community.dns