Documentation

digital_ocean_tag - Create and remove tag(s) to DigitalOcean resource.

New in version 2.2.

Synopsis

  • Create and remove tag(s) to DigitalOcean resource.

Options

parameter required default choices comments
api_token
no
DigitalOcean api token.
name
yes
The name of the tag. The supported characters for names include alphanumeric characters, dashes, and underscores.
resource_id
no
The ID of the resource to operate on.
resource_type
no droplet
  • droplet
The type of resource to operate on. Currently only tagging of droplets is supported.
state
no present
  • present
  • absent
Whether the tag should be present or absent on the resource.

Examples

- name: create a tag
  digital_ocean_tag:
    name: production
    state: present

- name: tag a resource; creating the tag if it does not exists
  digital_ocean_tag:
    name: "{{ item }}"
    resource_id: YYY
    state: present
  with_items:
    - staging
    - dbserver

- name: untag a resource
  digital_ocean_tag:
    name: staging
    resource_id: YYY
    state: absent

# Deleting a tag also untags all the resources that have previously been
# tagged with it
- name: remove a tag
  digital_ocean_tag:
    name: dbserver
    state: absent

Return Values

Common return values are documented here Return Values, the following are the fields unique to this module:

name description returned type sample
data a DigitalOcean Tag resource success and no resource constraint dict {'tag': {'name': 'awesome', 'resources': {'droplets': {'count': 0, 'last_tagged': None}}}}


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 2.0, Version 2 of the DigitalOcean API is used.

Status

This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.

Support

This module is community maintained without core committer oversight.

For more information on what this means please read Module Support

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