digital_ocean_domain - Create/delete a DNS record in DigitalOcean

New in version 1.6.

Synopsis

  • Create/delete a DNS record in DigitalOcean.

Requirements (on host that executes module)

  • python >= 2.6
  • dopy

Options

parameter required default choices comments
api_token
(added in 1.9.5)
no
DigitalOcean api token.
id
no
Numeric, the droplet id you want to operate on.
ip
no
The IP address to point a domain at.
name
no
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.
state
no present
  • present
  • absent
Indicate desired state of the target.

Examples

# Create a domain record

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

# Create a droplet and a corresponding domain record

- 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 }}"

Notes

Note

  • Two environment variables can be used, DO_API_KEY and DO_API_TOKEN. They both refer to the v2 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 api_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.

Status

This module is flagged as stableinterface which means that the maintainers for this module guarantee that no backward incompatible interface changes will be made.

For help in developing on modules, should you be so inclined, please read Community Information & Contributing, Testing Ansible and Developing Modules.

© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.4/digital_ocean_domain_module.html