community.general.digital_ocean_tag (0.2.1) — module

Create and remove tag(s) to DigitalOcean resource.

Authors: Victor Volle (@kontrafiktion)

Install collection

Install with ansible-galaxy collection install community.general:==0.2.1


Add to requirements.yml

  collections:
    - name: community.general
      version: 0.2.1

Description

Create and remove tag(s) to DigitalOcean resource.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create a tag
  digital_ocean_tag:
    name: production
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Tag a resource; creating the tag if it does not exist
  digital_ocean_tag:
    name: "{{ item }}"
    resource_id: "73333005"
    state: present
  loop:
    - staging
    - dbserver
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Untag a resource
  digital_ocean_tag:
    name: staging
    resource_id: "73333005"
    state: absent
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# 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

Inputs

    
name:
    description:
    - The name of the tag. The supported characters for names include alphanumeric characters,
      dashes, and underscores.
    required: true

state:
    choices:
    - present
    - absent
    default: present
    description:
    - Whether the tag should be present or absent on the resource.

timeout:
    default: 30
    description:
    - The timeout in seconds used for polling DigitalOcean's API.
    type: int

oauth_token:
    aliases:
    - api_token
    description:
    - 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'
    type: str

resource_id:
    aliases:
    - droplet_id
    description:
    - The ID of the resource to operate on.
    - The data type of resource_id is changed from integer to string since Ansible 2.5.

resource_type:
    choices:
    - droplet
    default: droplet
    description:
    - The type of resource to operate on. Currently, only tagging of droplets is supported.

validate_certs:
    default: true
    description:
    - If set to C(no), the SSL certificates will not be validated.
    - This should only set to C(no) used on personally controlled sites using self-signed
      certificates.
    type: bool

Outputs

data:
  description: a DigitalOcean Tag resource
  returned: success and no resource constraint
  sample:
    tag:
      name: awesome
      resources:
        droplets:
          count: 0
          last_tagged: null
  type: dict