-
Notifications
You must be signed in to change notification settings - Fork 1
/
get-vm-facts.yml
37 lines (33 loc) · 1.02 KB
/
get-vm-facts.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
---
- name: Get VM Facts
hosts: localhost
connection: local
gather_facts: no
vars_prompt:
name: vcenter_hostname
prompt: "Enter vCenter hostname"
name: vcenter_username
prompt: "Enter vCenter user name"
name: vcenter_password
prompt: "Enter password for {{ vcenter_username }}"
name: vsphere_datacenter
prompt: "Enter vSphere Datacenter name"
name: vm_name
prompt: "Enter VM name"
tasks:
- name: "Get VM Facts for {{ vm_name }}"
vmware_guest_facts:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
validate_certs: no
datacenter: "{{ vsphere_datacenter }}"
name: "{{ vm_name }}"
delegate_to: localhost
register: vmware_facts
- name: Display VMware facts
debug:
var: vmware_facts.instance.instance_uuid
- name: Display VMware facts as debug message
debug:
msg: "VM UUID is {{ vmware_facts.instance.instance_uuid }}"