dnsmadeeasy – Interface with dnsmadeeasy.com (a DNS hosting service) — Ansible Documentation

- AnsibleFest
- Products
- Community
- Webinars & Training
- Blog

Documentation

# dnsmadeeasy – Interface with dnsmadeeasy.com (a DNS hosting service)

- Synopsis
- Requirements
- Parameters
- Notes
- Examples
- Status

## Synopsis

- Manages DNS records via the v2 REST API of the DNS Made Easy service. It handles records only; there is no manipulation of domains or monitor/account support yet. See: https://www.dnsmadeeasy.com/integration/restapi/

## Requirements

The below requirements are needed on the host that executes this module.

- hashlib
- hmac

## Parameters

Parameter | Choices/Defaults | Comments
--- | --- | ---
account_key - / required |  | Account API Key.
account_secret - / required |  | Account Secret Key.
autoFailover boolean added in 2.4 | Choices: no ← yes | If true, fallback to the primary IP address is manual after a failover. If false, fallback to the primary IP address is automatic after a failover.
contactList - / required added in 2.4 | Default: "" | Name or id of the contact list that the monitor will notify. The default `''` means the Account Owner.
domain - / required |  | Domain to work with. Can be the domain name (e.g. "mydomain.com") or the numeric ID of the domain in DNS Made Easy (e.g. "839989") for faster resolution
failover boolean added in 2.4 | Choices: no ← yes | If `yes`, add or change the failover. This is applicable only for A records.
httpFile - added in 2.4 |  | The file at the Fqdn that the monitor queries for HTTP or HTTPS.
httpFqdn - added in 2.4 |  | The fully qualified domain name used by the monitor.
httpQueryString - added in 2.4 |  | The string in the httpFile that the monitor queries for HTTP or HTTPS.
ip1 - added in 2.4 |  | Primary IP address for the failover. Required if adding or changing the monitor or failover.
ip2 - added in 2.4 |  | Secondary IP address for the failover. Required if adding or changing the failover.
ip3 - added in 2.4 |  | Tertiary IP address for the failover.
ip4 - added in 2.4 |  | Quaternary IP address for the failover.
ip5 - added in 2.4 |  | Quinary IP address for the failover.
maxEmails - / required added in 2.4 | Default: 1 | Number of emails sent to the contact list by the monitor.
monitor boolean added in 2.4 | Choices: no ← yes | If `yes`, add or change the monitor. This is applicable only for A records.
port - / required added in 2.4 | Default: 80 | Port used by the monitor.
protocol - / required added in 2.4 | Choices: TCP UDP HTTP ← DNS SMTP HTTPS | Protocol used by the monitor.
record_name - |  | Record name to get/create/delete/update. If record_name is not specified; all records for the domain will be returned in "result" regardless of the state argument.
record_ttl - | Default: 1800 | record's "Time to live". Number of seconds the record remains cached in DNS servers.
record_type - | Choices: A AAAA CNAME ANAME HTTPRED MX NS PTR SRV TXT | Record type.
record_value - |  | Record value. HTTPRED: <redirection URL>, MX: <priority> <target name>, NS: <name server>, PTR: <target name>, SRV: <priority> <weight> <port> <target name>, TXT: <text value>" If record_value is not specified; no changes will be made and the record will be returned in 'result' (in other words, this module can be used to fetch a record's current id, type, and ttl)
sandbox boolean added in 2.7 | Choices: no ← yes | Decides if the sandbox API should be used. Otherwise (default) the production API of DNS Made Easy is used.
sensitivity - / required added in 2.4 | Choices: Low Medium ← High | Number of checks the monitor performs before a failover occurs where Low = 8, Medium = 5,and High = 3.
state - / required | Choices: present absent | whether the record should exist or not
systemDescription - / required added in 2.4 | Default: "" | Description used by the monitor.
validate_certs boolean | Choices: no yes ← | If `no`, SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates.

## Notes

Note

- The DNS Made Easy service requires that machines interacting with the API have the proper time and timezone set. Be sure you are within a few seconds of actual time by using NTP.
- This module returns record(s) and monitor(s) in the “result” element when ‘state’ is set to ‘present’. These values can be be registered and used in your playbooks.
- Only A records can have a monitor or failover.
- To add failover, the ‘failover’, ‘autoFailover’, ‘port’, ‘protocol’, ‘ip1’, and ‘ip2’ options are required.
- To add monitor, the ‘monitor’, ‘port’, ‘protocol’, ‘maxEmails’, ‘systemDescription’, and ‘ip1’ options are required.
- The monitor and the failover will share ‘port’, ‘protocol’, and ‘ip1’ options.

## Examples

    # fetch my.com domain records
    - dnsmadeeasy:
        account_key: key
        account_secret: secret
        domain: my.com
        state: present
      register: response

    # create / ensure the presence of a record
    - dnsmadeeasy:
        account_key: key
        account_secret: secret
        domain: my.com
        state: present
        record_name: test
        record_type: A
        record_value: 127.0.0.1

    # update the previously created record
    - dnsmadeeasy:
        account_key: key
        account_secret: secret
        domain: my.com
        state: present
        record_name: test
        record_value: 192.0.2.23

    # fetch a specific record
    - dnsmadeeasy:
        account_key: key
        account_secret: secret
        domain: my.com
        state: present
        record_name: test
      register: response

    # delete a record / ensure it is absent
    - dnsmadeeasy:
        account_key: key
        account_secret: secret
        domain: my.com
        record_type: A
        state: absent
        record_name: test

    # Add a failover
    - 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

    - 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

    # Add a monitor
    - 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: yes
        ip1: 127.0.0.2
        protocol: HTTP  # default
        port: 80  # default
        maxEmails: 1
        systemDescription: Monitor Test A record
        contactList: my contact list

    # Add a monitor with http options
    - 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: yes
        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

    # Add a monitor and a failover
    - 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: yes
        protocol: HTTPS
        port: 443
        maxEmails: 1
        systemDescription: monitoring my.com status
        contactList: emergencycontacts

    # Remove a failover
    - 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: no

    # Remove a monitor
    - 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: no

## Status

- This module is not guaranteed to have a backwards compatible interface. [preview]
- This module is maintained by the Ansible Community. [community]

### Authors

- Brice Burgess (@briceburg)

Hint

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