New in version 2.2.
| 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 |
| The type of resource to operate on. Currently, only tagging of droplets is supported. |
| state | no | present |
| Whether the tag should be present or absent on the resource. |
- 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
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}}}} |
Note
This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.
For help in developing on modules, should you be so inclined, please read Community Information & Contributing, Testing Ansible and Developing Modules.
© 2012–2017 Michael DeHaan
© 2017 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/latest/digital_ocean_tag_module.html