phoenixnap.bmc.tag (1.17.0) — module

Create/delete tag on phoenixNAP Bare Metal Cloud.

| "added in version" 0.12.0 of phoenixnap.bmc"

Authors: Pavle Jojkic (@pajuga) <pavlej@phoenixnap.com>, Goran Jelenic (@goranje) <goranje@phoenixnap.com>

preview | supported by certified

Install collection

Install with ansible-galaxy collection install phoenixnap.bmc:==1.17.0


Add to requirements.yml

  collections:
    - name: phoenixnap.bmc
      version: 1.17.0

Description

Create/delete tag on phoenixNAP Bare Metal Cloud.

This module has a dependency on requests

API is documented at U(https://developers.phoenixnap.com/docs/tags/1/overview).

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# All the examples assume that you have file config.yaml with your 'clientId' and 'clientSecret'
# in location: ~/.pnap/config.yaml

- name: Create new tag for account
  hosts: localhost
  gather_facts: false
  vars_files:
    - ~/.pnap/config.yaml
  tasks:
    - name: Create a tag
      phoenixnap.bmc.tag:
        client_id: "{{ clientId }}"
        client_secret: "{{ clientSecret }}"
        name: Environment
        description: This tag is used for all resources that need to be assigned to an environment.
        is_billing_tag: false
        state: present
      register: output
    - name: Print the tag information
      ansible.builtin.debug:
        var: output.tags
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Delete the tag
  hosts: localhost
  gather_facts: false
  vars_files:
    - ~/.pnap/config.yaml
  tasks:
    - name: Delete a tag
      phoenixnap.bmc.tag:
        client_id: "{{ clientId }}"
        client_secret: "{{ clientSecret }}"
        name: Environment
        state: absent
      register: output
    - name: Print the tag information
      ansible.builtin.debug:
        var: output.tags

Inputs

    
name:
    description: The unique name of the tag.
    type: str

state:
    choices:
    - present
    - absent
    default: present
    description: Indicate desired state of the target.
    type: str

client_id:
    description: Client ID (Application Management)
    type: str

description:
    description: The description of the tag.
    type: str

client_secret:
    description: Client Secret (Application Management)
    type: str

is_billing_tag:
    description: Whether or not to show the tag as part of billing and invoices.
    type: bool

Outputs

tags:
  contains:
    createdBy:
      description: The tag's creator.
      returned: always
      sample: USER
      type: str
    description:
      description: The description of the tag.
      returned: always
      sample: This tag is used for all resources that need to be assigned to an environment.
      type: str
    id:
      description: The unique id of the tag.
      returned: always
      sample: 604721852cf65253d151528b
      type: str
    isBillingTag:
      description: Whether or not to show the tag as part of billing and invoices.
      returned: always
      sample: true
      type: bool
    name:
      description: The name of the tag.
      returned: always
      sample: Environment
      type: str
    resourceAssignments:
      contains:
        resourceName:
          description: The resource name.
          sample: /bmc/servers/60ffafcdffb8b074c7968dad
          type: str
        value:
          description: The value of the tag assigned to the resource.
          sample: DEV
          type: str
      description: The tag's assigned resources.
      returned: always
      type: list
    values:
      description: The optional values of the tag.
      elements: str
      returned: always
      sample:
      - DEV
      - PROD
      type: list
  description: The tags information as list
  returned: success
  type: complex