Created
April 29, 2020 12:21
-
-
Save Akasurde/82dc8a75e52758f47bd8e708b211dee0 to your computer and use it in GitHub Desktop.
Reuse tag manager
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- | |
| - hosts: localhost | |
| tasks: | |
| - include_tasks: vmware_tag_manager.yml | |
| vars: | |
| vcenter_hostname: 'vc1.test.com' | |
| vcenter_password: 'password' | |
| vcenter_username: '[email protected]' | |
| object_name: 'Cluster1' | |
| object_type: ClusterComputeResource | |
| category: cat_0001 | |
| tags: | |
| - tag1 | |
| - tag2 | |
| - tag3 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| - name: Assign tags | |
| vmware_tag_manager: | |
| hostname: '{{ vcenter_hostname }}' | |
| username: '{{ vcenter_username }}' | |
| password: '{{ vcenter_password }}' | |
| validate_certs: no | |
| tag_names: | |
| - "{{ category }}:{{ item }}" | |
| object_name: "{{ object_name }}" | |
| object_type: "{{ object_type }}" | |
| state: add | |
| delegate_to: localhost | |
| with_item: | |
| - "{{ tags }}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment