40 lines
1.2 KiB
YAML
40 lines
1.2 KiB
YAML
- name: Create VM in vCenter
|
|
delegate_to: localhost
|
|
community.vmware.vmware_guest:
|
|
hostname: "{{ hypervisor_url }}"
|
|
username: "{{ hypervisor_username }}"
|
|
password: "{{ hypervisor_password }}"
|
|
validate_certs: false
|
|
datacenter: "{{ hypervisor_cluster }}"
|
|
cluster: "{{ hypervisor_node }}"
|
|
folder: "{{ vm_path }}"
|
|
name: "{{ hostname }}"
|
|
guest_id: otherGuest64
|
|
state: poweredon
|
|
disk:
|
|
- size_gb: "{{ vm_size }}"
|
|
type: thin
|
|
datastore: "{{ hypervisor_storage }}"
|
|
hardware:
|
|
memory_mb: "{{ vm_memory }}"
|
|
num_cpus: "{{ vm_cpus }}"
|
|
boot_firmware: efi
|
|
secure_boot: false
|
|
cdrom:
|
|
- controller_number: 0
|
|
unit_number: 0
|
|
controller_type: sata
|
|
state: present
|
|
type: iso
|
|
iso_path: "{{ boot_iso }}"
|
|
networks:
|
|
- name: "{{ vm_nif }}"
|
|
type: dhcp
|
|
vlan: "{{ vlan_name | default(omit) }}"
|
|
register: vmware_guest_result
|
|
failed_when:
|
|
- vmware_guest_result.failed is defined and vmware_guest_result.failed
|
|
- "'error' in vmware_guest_result"
|
|
- "'failed' in vmware_guest_result"
|
|
- vmware_guest_result.rc is defined and vmware_guest_result.rc != 0
|