community / community.digitalocean / 1.26.0 / module / digital_ocean_domain_record Manage DigitalOcean domain records | "added in version" 1.1.0 of community.digitalocean" Authors: Adam Papai (@woohgit)community.digitalocean.digital_ocean_domain_record (1.26.0) — module
Install with ansible-galaxy collection install community.digitalocean:==1.26.0
collections: - name: community.digitalocean version: 1.26.0
Create/delete a domain record in DigitalOcean.
- 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
tag: choices: - issue - wildissue - iodef description: - The parameter tag for CAA records. type: str ttl: default: 1800 description: - Time to live for the record, in seconds. type: int data: description: - This is the value of the record, depending on the record type. type: str name: default: '@' description: - Required for C(A, AAAA, CNAME, TXT, SRV) records. The host name, alias, or service being defined by the record. type: str port: description: - The port that the service is accessible on for SRV records only. type: int type: choices: - A - AAAA - CNAME - MX - TXT - SRV - NS - CAA description: - The type of record you would like to create. type: str flags: description: - An unsignedinteger between 0-255 used for CAA records. type: int state: choices: - present - absent default: present description: - Indicate desired state of the target. type: str domain: description: - Name of the domain. required: true type: str weight: description: - The weight of records with the same priority for SRV records only. type: int priority: description: - The priority of the host for C(SRV, MX) records). type: int record_id: description: - Used with C(force_update=yes) and C(state='absent') to update or delete a specific record. type: int oauth_token: aliases: - API_TOKEN description: - DigitalOcean OAuth token. Can be specified in C(DO_API_KEY), C(DO_API_TOKEN), or C(DO_OAUTH_TOKEN) environment variables type: str force_update: default: false description: - If there is already a record with the same C(name) and C(type) force update it. type: bool
data: description: a DigitalOcean Domain Record returned: success sample: data: 192.168.0.1 flags: 16 id: 3352896 name: www port: 5556 priority: 10 tag: issue ttl: 3600 type: CNAME weight: 10 type: dict