Skip to content

Instantly share code, notes, and snippets.

@Akasurde
Created April 29, 2020 12:21
Show Gist options
  • Save Akasurde/82dc8a75e52758f47bd8e708b211dee0 to your computer and use it in GitHub Desktop.
Save Akasurde/82dc8a75e52758f47bd8e708b211dee0 to your computer and use it in GitHub Desktop.
Reuse tag manager
---
- 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
- 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