Note
This plugin is part of the community.vmware collection.
To install it use: ansible-galaxy collection install community.vmware
.
To use it in a playbook, specify: community.vmware.vmware_tag_manager
.
The below requirements are needed on the host that executes this module.
Parameter | Choices/Defaults | Comments |
---|---|---|
hostname string | The hostname or IP address of the vSphere vCenter server. If the value is not specified in the task, the value of environment variable VMWARE_HOST will be used instead. | |
object_name string / required | Name of the object to work with. For DistributedVirtualPortgroups the format should be "switch_name:portgroup_name" | |
object_type string / required |
| Type of object to work with. |
password string | The password of the vSphere vCenter server. If the value is not specified in the task, the value of environment variable VMWARE_PASSWORD will be used instead.aliases: pass, pwd | |
port integer | Default: 443 | The port number of the vSphere vCenter. If the value is not specified in the task, the value of environment variable VMWARE_PORT will be used instead. |
protocol string |
| The connection to protocol. |
state string |
| If state is set to add or present will add the tags to the existing tag list of the given object.If state is set to remove or absent will remove the tags from the existing tag list of the given object.If state is set to set will replace the tags of the given objects with the user defined list of tags. |
tag_names list / elements=raw / required | List of tag(s) to be managed. User can also specify category name by specifying colon separated value. For example, "category_name:tag_name". User can also specify tag and category as dict, when tag or category contains colon. See example for more information. Added in version 2.10. User can skip category name if you have unique tag names. | |
username string | The username of the vSphere vCenter server. If the value is not specified in the task, the value of environment variable VMWARE_USER will be used instead.aliases: admin, user | |
validate_certs boolean |
| Allows connection when SSL certificates are not valid. Set to no when certificates are not trusted.If the value is not specified in the task, the value of environment variable VMWARE_VALIDATE_CERTS will be used instead. |
Note
- name: Add tags to a virtual machine community.vmware.vmware_tag_manager: hostname: '{{ vcenter_hostname }}' username: '{{ vcenter_username }}' password: '{{ vcenter_password }}' validate_certs: no tag_names: - Sample_Tag_0002 - Category_0001:Sample_Tag_0003 object_name: Fedora_VM object_type: VirtualMachine state: add delegate_to: localhost - name: Specify tag and category as dict community.vmware.vmware_tag_manager: hostname: '{{ vcenter_hostname }}' username: '{{ vcenter_username }}' password: '{{ vcenter_password }}' validate_certs: no tag_names: - tag: tag_0001 category: cat_0001 - tag: tag_0002 category: cat_0002 object_name: Fedora_VM object_type: VirtualMachine state: add delegate_to: localhost - name: Remove a tag from a virtual machine community.vmware.vmware_tag_manager: hostname: '{{ vcenter_hostname }}' username: '{{ vcenter_username }}' password: '{{ vcenter_password }}' validate_certs: no tag_names: - Sample_Tag_0002 object_name: Fedora_VM object_type: VirtualMachine state: remove delegate_to: localhost - name: Add tags to a distributed virtual switch community.vmware.vmware_tag_manager: hostname: '{{ vcenter_hostname }}' username: '{{ vcenter_username }}' password: '{{ vcenter_password }}' validate_certs: no tag_names: - Sample_Tag_0003 object_name: Switch_0001 object_type: DistributedVirtualSwitch state: add delegate_to: localhost - name: Add tags to a distributed virtual portgroup community.vmware.vmware_tag_manager: hostname: '{{ vcenter_hostname }}' username: '{{ vcenter_username }}' password: '{{ vcenter_password }}' validate_certs: no tag_names: - Sample_Tag_0004 object_name: Switch_0001:Portgroup_0001 object_type: DistributedVirtualPortgroup state: add delegate_to: localhost
Common return values are documented here, the following are the fields unique to this module:
Key | Returned | Description |
---|---|---|
tag_status list / elements=string | on success | metadata about tags related to object configuration Sample: {'current_tags': ['backup', 'security'], 'desired_tags': ['security'], 'previous_tags': ['backup', 'security']} |
© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.10/collections/community/vmware/vmware_tag_manager_module.html