community / community.general / 6.6.8 / module / memset_zone_record Create and delete records in Memset DNS zones Authors: Simon Weald (@glitchcrab)community.general.memset_zone_record (6.6.8) — module
Install with ansible-galaxy collection install community.general:==6.6.8
collections: - name: community.general version: 6.6.8
Manage DNS records in a Memset account.
# Create DNS record for www.domain.com - name: Create DNS record community.general.memset_zone_record: api_key: dcf089a2896940da9ffefb307ef49ccd state: present zone: domain.com type: A record: www address: 1.2.3.4 ttl: 300 relative: false delegate_to: localhost
# create an SPF record for domain.com - name: Create SPF record for domain.com community.general.memset_zone_record: api_key: dcf089a2896940da9ffefb307ef49ccd state: present zone: domain.com type: TXT address: "v=spf1 +a +mx +ip4:a1.2.3.4 ?all" delegate_to: localhost
# create multiple DNS records - name: Create multiple DNS records community.general.memset_zone_record: api_key: dcf089a2896940da9ffefb307ef49ccd zone: "{{ item.zone }}" type: "{{ item.type }}" record: "{{ item.record }}" address: "{{ item.address }}" delegate_to: localhost with_items: - { 'zone': 'domain1.com', 'type': 'A', 'record': 'www', 'address': '1.2.3.4' } - { 'zone': 'domain2.com', 'type': 'A', 'record': 'mail', 'address': '4.3.2.1' }
ttl: choices: - 0 - 300 - 600 - 900 - 1800 - 3600 - 7200 - 10800 - 21600 - 43200 - 86400 default: 0 description: - The record's TTL in seconds (will inherit zone's TTL if not explicitly set). This must be a valid int from U(https://www.memset.com/apidocs/methods_dns.html#dns.zone_record_create). type: int type: choices: - A - AAAA - CNAME - MX - NS - SRV - TXT description: - The type of DNS record to create. required: true type: str zone: description: - The name of the zone to which to add the record to. required: true type: str state: choices: - absent - present default: present description: - Indicates desired state of resource. type: str record: default: '' description: - The subdomain to create. required: false type: str address: aliases: - ip - data description: - The address for this record (can be IP or text string depending on record type). required: true type: str api_key: description: - The API key obtained from the Memset control panel. required: true type: str priority: default: 0 description: - C(SRV) and C(TXT) record priority, in the range 0 > 999 (inclusive). type: int relative: default: false description: - If set then the current domain is added onto the address field for C(CNAME), C(MX), C(NS) and C(SRV)record types. type: bool
memset_api: contains: address: description: Record content (may be an IP, string or blank depending on record type). returned: always sample: 1.1.1.1 type: str id: description: Record ID. returned: always sample: b0bb1ce851aeea6feeb2dc32fe83bf9c type: str priority: description: Priority for C(MX) and C(SRV) records. returned: always sample: 10 type: int record: description: Name of record. returned: always sample: www type: str relative: description: Adds the current domain onto the address field for C(CNAME), C(MX), C(NS) and C(SRV) types. returned: always sample: false type: bool ttl: description: Record TTL. returned: always sample: 10 type: int type: description: Record type. returned: always sample: AAAA type: str zone_id: description: Zone ID. returned: always sample: b0bb1ce851aeea6feeb2dc32fe83bf9c type: str description: Record info from the Memset API. returned: when state == present type: complex