-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate-esxi-vm.yml
More file actions
33 lines (32 loc) · 969 Bytes
/
create-esxi-vm.yml
File metadata and controls
33 lines (32 loc) · 969 Bytes
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
---
- name: Create a Lab VM on ESXi
connection: 'local'
gather_facts: False
hosts: '{{ target_vm }}'
vars_prompt:
- name: target_esxi
prompt: "Which ESXi server should be used?"
private: no
- name: target_vm
prompt: "Which VM will be created?"
private: no
tasks:
- name: Create a VM
vmware_guest:
hostname: '{{ target_esxi }}.{{ domain }}'
username: 'root'
password: '{{ root_pw }}'
esxi_hostname : '{{ target_esxi }}.{{ domain }}'
folder: '/ha-datacenter/vm'
datastore: '{{ target_esxi }}_das01'
validate_certs: '{{ validate_certs }}'
name: '{{ target_vm }}'
state: 'poweredoff'
guest_id: '{{ guest_id }}'
disk: '{{ disk_list }}'
hardware: '{{ hardware }}'
networks: '{{ networks }}'
register: vm
- name: 'VM UUID'
debug:
msg: '{{ target_vm }} uuid is {{ vm.instance.hw_product_uuid }}'