-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvmware_snapshot_remove_playbook.yml
41 lines (38 loc) · 1.21 KB
/
vmware_snapshot_remove_playbook.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
---
- name: Get VMs
# hosts: localhost
hosts: machines
connection: local
tasks:
- name: include vars
include_vars:
dir: group_vars
- name: Gather VM
#vmware_guest_facts:
vmware_guest_info:
validate_certs: False
hostname: '{{ site }}{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
datacenter: '{{ site }}{{ vcenter_datacenter }}'
# name: "usrdavs012ccp8a"
name: "{{ inventory_hostname }}"
schema: "vsphere"
properties: ["config.hardware.memoryMB", "guest.disk", "guest.net", "overallStatus"]
delegate_to: localhost
register: vminfo
- debug:
msg: "{{ vminfo }}"
- name: Remove all snapshots of a VM
vmware_guest_snapshot:
hostname: "{{ site }}{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: "{{ site }}{{ vcenter_datacenter }}"
# folder: "/{{ datacenter }}/"
folder: "/"
# name: usrdads022ccp8a
name: "{{ inventory_hostname }}"
state: remove_all
validate_certs: False
delegate_to: localhost