Monday, September 4, 2017

Removing a VM on ESXi standalone with Ansible

The pysphere Python package must be installed.

 hosts: 127.0.0.1
  connection: local
  user: username
  sudo: false
  gather_facts: false
  serial: 1
  
  tasks:

    - vsphere_guest: 
        vcenter_hostname: <<ESXi-IP>> 
        username: root 
        password: <<password>>
        esxi: 
          datacenter: ha-datacenter
        guest: <<virtual-machine-name>>
        state: absent
        force: yes
        validate_certs: false