digital_ocean_domain – Create/delete a DNS domain in DigitalOcean

Synopsis

  • Create/delete a DNS domain in DigitalOcean.

Requirements

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

  • python >= 2.6

Parameters

Parameter Choices/Defaults Comments
id
-
Numeric, the droplet id you want to operate on.

aliases: droplet_id
ip
-
An 'A' record for '@' ($ORIGIN) will be created with the value 'ip'. 'ip' is an IP version 4 address.
name
-
String, this is the name of the droplet - must be formatted by hostname rules, or the name of a SSH key, or the name of a domain.
oauth_token
string
DigitalOcean OAuth token.
There are several other environment variables which can be used to provide this value.
i.e., - 'DO_API_TOKEN', 'DO_API_KEY', 'DO_OAUTH_TOKEN' and 'OAUTH_TOKEN'

aliases: api_token
state
-
    Choices:
  • present ←
  • absent
Indicate desired state of the target.
timeout
integer
Default:
30
The timeout in seconds used for polling DigitalOcean's API.
validate_certs
boolean
    Choices:
  • no
  • yes ←
If set to no, the SSL certificates will not be validated.
This should only set to no used on personally controlled sites using self-signed certificates.

Notes

Note

  • Environment variables DO_OAUTH_TOKEN can be used for the oauth_token.
  • As of Ansible 1.9.5 and 2.0, Version 2 of the DigitalOcean API is used, this removes client_id and api_key options in favor of oauth_token.
  • If you are running Ansible 1.9.4 or earlier you might not be able to use the included version of this module as the API version used has been retired.

Examples

# Create a domain

- digital_ocean_domain:
    state: present
    name: my.digitalocean.domain
    ip: 127.0.0.1

# Create a droplet and a corresponding domain

- digital_ocean:
    state: present
    name: test_droplet
    size_id: 1gb
    region_id: sgp1
    image_id: ubuntu-14-04-x64


  register: test_droplet

- digital_ocean_domain:
    state: present
    name: "{{ test_droplet.droplet.name }}.my.domain"
    ip: "{{ test_droplet.droplet.ip_address }}"

Status

Authors

  • Michael Gregson (@mgregson)

Hint

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