Ansible playbook to delete selected VMs from file.
####################### delete selected VMs#######################
---
- name: Delete VMs from Vcenter
hosts: localhost
gather_facts: no
vars:
hostname: 192.168.0.x
username: administrator@vsphere.local
password: abcd@1234
tasks:
- name: Delete Vms
vmware_guest:
hostname: "{{ hostname }}"
username: "{{ username }}"
password: "{{ password }}"
validate_certs: False
name: "{{ item }}"
state: absent
wait_for_ip_address: no
delegate_to: localhost
with_lines: cat vmname.txt
No comments:
Post a Comment