Hello all, I have been using Ansible to manage snapshots for single 
specified vm's. Is there a way to have Ansible remove snapshots for all 
vm's in Vmware datacenter? If this is posssible, would you mind providing a 
play book example?

Below is an example where I remove a snapshot from a single vm:

- name: VM Remove Snapshot
  hosts: localhost
  gather_facts: false
  connection: local
  vars:
    vcenter_hostname: vspherefqdn
    vcenter_user: ansiblesusername
    vcenter_pass: changeme
    esxhost: 192,168.1.100
    datastore: LUN01
    name: "{{ vm_name }}"
    notes: Ansible Test
    dumpfacts: False
  tasks:
    - name: Remove all snapshots
      vmware_guest_snapshot:
        validate_certs: False
        hostname: "{{ vcenter_hostname }}"
        username: "{{ vcenter_user }}"
        password: "{{ vcenter_pass }}"
        datacenter: TST1
        name: "{{ name }}"
        folder: ''
        state: remove_all
      delegate_to: localhost

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/d145836c-04dd-4593-8f5d-2735effdb373%40googlegroups.com.

Reply via email to