Skip to content

Instantly share code, notes, and snippets.

@goneri
Created September 24, 2020 15:35
Show Gist options
  • Save goneri/6afd05397390cf5a0976f3611814949a to your computer and use it in GitHub Desktop.
Save goneri/6afd05397390cf5a0976f3611814949a to your computer and use it in GitHub Desktop.
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