Note
This plugin is part of the opentelekomcloud.cloud collection (version 0.0.1).
To install it use: ansible-galaxy collection install opentelekomcloud.cloud
.
To use it in a playbook, specify: opentelekomcloud.cloud.tag
.
New in version 0.0.1: of opentelekomcloud.cloud
The below requirements are needed on the host that executes this module.
openstacksdk
openstacksdk >= 0.36.0
otcextensions
python >= 2.7
python >= 3.6
Note
One and only one of server
, floating_ip
, network
, port
, router
, security_group
, security_group_rule
, subnet
, trunk
should be set.
The standard OpenStack environment variables, such as OS_USERNAME
may be used instead of providing explicit values.
Auth information is driven by openstacksdk, which means that values can come from a yaml config file in /etc/ansible/openstack.yaml, /etc/openstack/clouds.yaml or ~/.config/openstack/clouds.yaml, then from standard environment variables, then finally by explicit parameters in plays. More information can be found at https://docs.openstack.org/openstacksdk/
---
- name: replace all tags with a single tag on a server
os_tag:
server: "{{ server_name }}"
state: present
tags:
- new_tag
mode: replace
- name: replace all tags with a single tag on a network
os_tag:
network: "{{ network_name }}"
state: present
tags:
- new_tag
mode: replace
- name: append tags on instance
os_tag:
server: "{{ server_name }}"
state: present
mode: set
tags:
- new_tag1
- new_tag2
- name: remove all tags
os_tag:
server: "{{ server_name }}"
state: present
tags:
- name: remove only given tags
os_tag:
server: "{{ server_name }}"
state: present
tags:
- new_tag1
Common return values are documented here, the following are the fields unique to this module:
Key | Returned | Description |
---|---|---|
tags
list
/ elements=string
|
success |
Present tags on the instance.
Sample:
['tag1', 'tag2']
|
Artem Goncharov (@gtema)