W3cubDocs

/Ansible

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.

Requirements (on host that executes module)

  • python >= 2.6

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 Common 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.

Note

As of Ansible 2.0, Version 2 of the DigitalOcean API is used.

This is a Core Module

For more information on what this means please read Core Modules

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

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