Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
vmware_rest.yaml
- name: Collect the list of the existing VM
vcenter_vm_info:
register: existing_vms
until: existing_vms is not failed
- name: Turn off the VM
vcenter_vm_power:
state: stop
vm: '{{ item.vm }}'
with_items: "{{ existing_vms.value }}"
ignore_errors: yes
- name: Delete some VM
vcenter_vm:
state: absent
vm: '{{ item.vm }}'
with_items: "{{ existing_vms.value }}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment