community.vmware.vmware_tag module – Manage VMware tags
Note
This module is part of the community.vmware collection (version 5.1.0).
You might already have this collection installed if you are using the ansible
package.
It is not included in ansible-core
.
To check whether it is installed, run ansible-galaxy collection list
.
To install it, use: ansible-galaxy collection install community.vmware
.
You need further requirements to be able to use this module,
see Requirements for details.
To use it in a playbook, specify: community.vmware.vmware_tag
.
Synopsis
This module can be used to create / delete / update VMware tags.
Tag feature is introduced in vSphere 6 version, so this module is not supported in the earlier versions of vSphere.
Requirements
The below requirements are needed on the host that executes this module.
vSphere Automation SDK
Parameters
Parameter |
Comments |
---|---|
The unique ID generated by vCenter should be used to. User can get this unique ID from facts module. Required if |
|
The name of category. Required if |
|
The hostname or IP address of the vSphere vCenter server. If the value is not specified in the task, the value of environment variable |
|
The password of the vSphere vCenter server. If the value is not specified in the task, the value of environment variable |
|
The port number of the vSphere vCenter. If the value is not specified in the task, the value of environment variable Default: |
|
The connection to protocol. Choices:
|
|
Address of a proxy that will receive all HTTPS requests and relay them. The format is a hostname or a IP. If the value is not specified in the task, the value of environment variable |
|
Port of the HTTP proxy that will receive all HTTPS requests and relay them. If the value is not specified in the task, the value of environment variable |
|
The state of tag. If set to If set to If set to If set to Choices:
|
|
The tag description. This is required only if This parameter is ignored, when Process of updating tag only allows description change. Default: |
|
The name of tag to manage. |
|
The username of the vSphere vCenter server. If the value is not specified in the task, the value of environment variable |
|
Allows connection when SSL certificates are not valid. Set to If the value is not specified in the task, the value of environment variable Choices:
|
Notes
Note
All modules requires API write access and hence is not supported on a free ESXi license.
All variables and VMware object names are case sensitive.
Examples
- name: Create a tag
community.vmware.vmware_tag:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
category_id: 'urn:vmomi:InventoryServiceCategory:e785088d-6981-4b1c-9fb8-1100c3e1f742:GLOBAL'
tag_name: Sample_Tag_0002
tag_description: Sample Description
state: present
delegate_to: localhost
- name: Update tag description
community.vmware.vmware_tag:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
tag_name: Sample_Tag_0002
tag_description: Some fancy description
state: present
delegate_to: localhost
- name: Delete tag
community.vmware.vmware_tag:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
tag_name: Sample_Tag_0002
state: absent
delegate_to: localhost
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
dictionary of tag metadata Returned: on success Sample: |
Authors
Abhijeet Kasurde (@Akasurde)