ansible.builtin.memset_zone_record (v2.9.27) — module

Create and delete records in Memset DNS zones.

| "added in version" 2.6 of ansible.builtin"

Authors: Simon Weald (@glitchcrab)

preview | supported by community

Install Ansible via pip

Install with pip install ansible==2.9.27

Description

Manage DNS records in a Memset account.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# 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
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# 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
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# 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' }

Inputs

    
ttl:
    choices:
    - 0
    - 300
    - 600
    - 900
    - 1800
    - 3600
    - 7200
    - 10800
    - 21600
    - 43200
    - 86400
    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:
    choices:
    - A
    - AAAA
    - CNAME
    - MX
    - NS
    - SRV
    - TXT
    description:
    - The type of DNS record to create.
    required: true

zone:
    description:
    - The name of the zone to which to add the record to.
    required: true

state:
    choices:
    - absent
    - present
    default: present
    description:
    - Indicates desired state of resource.

record:
    description:
    - The subdomain to create.
    required: false

address:
    aliases:
    - ip
    - data
    description:
    - The address for this record (can be IP or text string depending on record type).
    required: true

api_key:
    description:
    - The API key obtained from the Memset control panel.
    required: true

priority:
    description:
    - C(SRV) and C(TXT) record priority, in the range 0 > 999 (inclusive).

relative:
    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

Outputs

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