memset_zone_record - Create and delete records in Memset DNS zones.

New in version 2.6.

Synopsis

  • Manage DNS records in a Memset account.

Parameters

Parameter Choices/Defaults Comments
address
required
The address for this record (can be IP or text string depending on record type).

aliases: ip, data
api_key
required
The API key obtained from the Memset control panel.
priority
SRV and TXT record priority, in the range 0 > 999 (inclusive).
record
The subdomain to create.
relative
bool
    Choices:
  • no
  • yes
If set then the current domain is added onto the address field for CNAME, MX, NS and SRVrecord types.
state
    Choices:
  • absent
  • present
Indicates desired state of resource.
ttl
    Choices:
  • 0
  • 300
  • 600
  • 900
  • 1800
  • 3600
  • 7200
  • 10800
  • 21600
  • 43200
  • 86400
The record's TTL in seconds (will inherit zone's TTL if not explicitly set). This must be a valid int from https://www.memset.com/apidocs/methods_dns.html#dns.zone_record_create.
type
required
    Choices:
  • A
  • AAAA
  • CNAME
  • MX
  • NS
  • SRV
  • TXT
The type of DNS record to create.
zone
required
The name of the zone to which to add the record to.

Notes

Note

  • Zones can be thought of as a logical group of domains, all of which share the same DNS records (i.e. they point to the same IP). An API key generated via the Memset customer control panel is needed with the following minimum scope - dns.zone_create, dns.zone_delete, dns.zone_list.
  • Currently this module can only create one DNS record at a time. Multiple records should be created using with_items.

Examples

# Create DNS record for www.domain.com
- name: create DNS record
  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
  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
  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' }

Return Values

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

Key Returned Description
memset_api
complex
when state == present
Record info from the Memset API.

address
string
always
Record content (may be an IP, string or blank depending on record type).

Sample:
1.1.1.1
id
string
always
Record ID.

Sample:
b0bb1ce851aeea6feeb2dc32fe83bf9c
priority
integer
always
Priority for MX and SRV records.

Sample:
10
record
string
always
Name of record.

Sample:
www
relative
boolean
always
Adds the current domain onto the address field for CNAME, MX, NS and SRV types.

ttl
integer
always
Record TTL.

Sample:
10
type
string
always
Record type.

Sample:
AAAA
zone_id
string
always
Zone ID.

Sample:
b0bb1ce851aeea6feeb2dc32fe83bf9c


Status

This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.

Maintenance

This module is flagged as community which means that it is maintained by the Ansible Community. See Module Maintenance & Support for more info.

For a list of other modules that are also maintained by the Ansible Community, see here.

Author

  • Simon Weald (@analbeard)

Hint

If you notice any issues in this documentation you can edit this document to improve it.

© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.6/modules/memset_zone_record_module.html