- 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: "{{ rhel_iso | default(omit) }}" - controller_number: 0 unit_number: 1 controller_type: sata state: present type: iso iso_path: "{{ boot_iso }}" networks: - vlan: "{{ vlan_name }}" type: static ip: "{{ inventory_hostname }}" netmask: "{{ vm_nm | default('255.255.255.0') }}" 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