Note
This module is part of the community.digitalocean collection (version 1.27.0).
You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.
To install it, use: ansible-galaxy collection install community.digitalocean.
To use it in a playbook, specify: community.digitalocean.digital_ocean_domain_record.
New in community.digitalocean 1.1.0
Parameter | Comments |
|---|---|
data string | This is the value of the record, depending on the record type. |
domain string / required | Name of the domain. |
flags integer | An unsignedinteger between 0-255 used for CAA records. |
force_update boolean | If there is already a record with the same Choices:
|
name string | Required for Default: |
oauth_token aliases: API_TOKEN string | DigitalOcean OAuth token. Can be specified in |
port integer | The port that the service is accessible on for SRV records only. |
priority integer | The priority of the host for |
record_id integer | Used with |
state string | Indicate desired state of the target. Choices:
|
tag string | The parameter tag for CAA records. Choices:
|
ttl integer | Time to live for the record, in seconds. Default: |
type string | The type of record you would like to create. Choices:
|
weight integer | The weight of records with the same priority for SRV records only. |
Note
- name: Create default A record for example.com
community.digitalocean.digital_ocean_domain_record:
state: present
oauth_token: "{{ lookup('ansible.builtin.env', 'DO_API_TOKEN') }}"
domain: example.com
type: A
name: "@"
data: 127.0.0.1
- name: Create A record for www
community.digitalocean.digital_ocean_domain_record:
state: present
oauth_token: "{{ lookup('ansible.builtin.env', 'DO_API_TOKEN') }}"
domain: example.com
type: A
name: www
data: 127.0.0.1
- name: Update A record for www based on name/type/data
community.digitalocean.digital_ocean_domain_record:
state: present
oauth_token: "{{ lookup('ansible.builtin.env', 'DO_API_TOKEN') }}"
domain: example.com
type: A
name: www
data: 127.0.0.2
force_update: true
- name: Update A record for www based on record_id
community.digitalocean.digital_ocean_domain_record:
state: present
oauth_token: "{{ lookup('ansible.builtin.env', 'DO_API_TOKEN') }}"
domain: example.com
record_id: 123456
type: A
name: www
data: 127.0.0.2
force_update: true
- name: Remove www record based on name/type/data
community.digitalocean.digital_ocean_domain_record:
state: absent
oauth_token: "{{ lookup('ansible.builtin.env', 'DO_API_TOKEN') }}"
domain: example.com
type: A
name: www
data: 127.0.0.1
- name: Remove www record based on record_id
community.digitalocean.digital_ocean_domain_record:
state: absent
oauth_token: "{{ lookup('ansible.builtin.env', 'DO_API_TOKEN') }}"
domain: example.com
record_id: 1234567
- name: Create CNAME records for www, git and status subdomains
community.digitalocean.digital_ocean_domain_record:
state: present
oauth_token: "{{ lookup('ansible.builtin.env', 'DO_API_TOKEN') }}"
domain: example.com
type: CNAME
name: "{{ item }}"
data: example.com
with_items:
- www
- git
- status
- name: Create MX record with priority 10 for example.com
community.digitalocean.digital_ocean_domain_record:
state: present
oauth_token: "{{ lookup('ansible.builtin.env', 'DO_API_TOKEN') }}"
domain: example.com
type: MX
data: mail1.example.com
priority: 10
Common return values are documented here, the following are the fields unique to this module:
Key | Description |
|---|---|
data dictionary | a DigitalOcean Domain Record Returned: success Sample: |
© 2012–2018 Michael DeHaan
© 2018–2025 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/latest/collections/community/digitalocean/digital_ocean_domain_record_module.html