community.digitalocean.digital_ocean_domain (1.26.0) — module

Create/delete a DNS domain in DigitalOcean

Authors: Michael Gregson (@mgregson)

Install collection

Install with ansible-galaxy collection install community.digitalocean:==1.26.0


Add to requirements.yml

  collections:
    - name: community.digitalocean
      version: 1.26.0

Description

Create/delete a DNS domain in DigitalOcean.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create a domain
  community.digitalocean.digital_ocean_domain:
    state: present
    name: my.digitalocean.domain
    ip: 127.0.0.1
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create a domain (and associate to Project "test")
  community.digitalocean.digital_ocean_domain:
    state: present
    name: my.digitalocean.domain
    ip: 127.0.0.1
    project: test
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Create a droplet and corresponding domain
- name: Create a droplet
  community.digitalocean.digital_ocean:
    state: present
    name: test_droplet
    size_id: 1gb
    region_id: sgp1
    image_id: ubuntu-14-04-x64
  register: test_droplet
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create a corresponding domain
  community.digitalocean.digital_ocean_domain:
    state: present
    name: "{{ test_droplet.droplet.name }}.my.domain"
    ip: "{{ test_droplet.droplet.ip_address }}"

Inputs

    
id:
    aliases:
    - droplet_id
    description:
    - The droplet id you want to operate on.
    type: int

ip:
    aliases:
    - ip4
    - ipv4
    description:
    - An 'A' record for '@' ($ORIGIN) will be created with the value 'ip'.  'ip' is an
      IP version 4 address.
    type: str

ip6:
    aliases:
    - ipv6
    description:
    - An 'AAAA' record for '@' ($ORIGIN) will be created with the value 'ip6'.  'ip6'
      is an IP version 6 address.
    type: str

name:
    description:
    - The name of the droplet - must be formatted by hostname rules, or the name of a
      SSH key, or the name of a domain.
    type: str

state:
    choices:
    - present
    - absent
    default: present
    description:
    - Indicate desired state of the target.
    type: str

baseurl:
    default: https://api.digitalocean.com/v2
    description:
    - DigitalOcean API base url.
    type: str

timeout:
    default: 30
    description:
    - The timeout in seconds used for polling DigitalOcean's API.
    type: int

oauth_token:
    aliases:
    - api_token
    description:
    - DigitalOcean OAuth token.
    - There are several other environment variables which can be used to provide this
      value.
    - i.e., - C(DO_API_TOKEN), C(DO_API_KEY), C(DO_OAUTH_TOKEN) and C(OAUTH_TOKEN).
    type: str

project_name:
    aliases:
    - project
    default: ''
    description:
    - Project to assign the resource to (project name, not UUID).
    - Defaults to the default project of the account (empty string).
    - Currently only supported when creating domains.
    required: false
    type: str

validate_certs:
    default: true
    description:
    - If set to C(no), the SSL certificates will not be validated.
    - This should only set to C(no) used on personally controlled sites using self-signed
      certificates.
    type: bool