Ansible-Bootstrap/roles/virtualization/tasks/vmware.yml

39 lines
1.1 KiB
YAML
Raw Normal View History

2024-03-19 23:02:50 +01:00
- name: Create VM in vCenter
delegate_to: localhost
2024-07-11 22:20:45 +02:00
community.vmware.vmware_guest:
2024-03-19 23:02:50 +01:00
hostname: "{{ hypervisor_url }}"
username: "{{ hypervisor_username }}"
password: "{{ hypervisor_password }}"
2024-07-11 22:09:58 +02:00
validate_certs: false
2024-03-19 23:02:50 +01:00
datacenter: "{{ hypervisor_cluster }}"
cluster: "{{ hypervisor_node }}"
folder: "{{ vm_path }}"
name: "{{ hostname }}"
2024-07-11 22:20:45 +02:00
guest_id: otherGuest64
2024-03-19 23:02:50 +01:00
state: poweredon
disk:
- size_gb: "{{ vm_size }}"
type: thin
datastore: "{{ hypervisor_storage }}"
hardware:
memory_mb: "{{ vm_memory }}"
num_cpus: "{{ vm_cpus }}"
2024-07-11 22:20:45 +02:00
boot_firmware: efi
2024-03-19 23:02:50 +01:00
secure_boot: false
cdrom:
- controller_number: 0
unit_number: 0
2024-07-11 22:20:45 +02:00
controller_type: sata
2024-03-19 23:02:50 +01:00
state: present
type: iso
iso_path: "{{ boot_iso }}"
networks:
- vlan: "{{ vlan_name }}"
type: dhcp
2024-07-11 22:31:13 +02:00
register: vmware_guest_result
failed_when:
2024-10-28 19:25:49 +01:00
- vmware_guest_result.failed is defined and vmware_guest_result.failed
2024-07-11 22:31:13 +02:00
- "'error' in vmware_guest_result"
- "'failed' in vmware_guest_result"
- vmware_guest_result.rc is defined and vmware_guest_result.rc != 0