54 lines
1.3 KiB
YAML
54 lines
1.3 KiB
YAML
---
|
|
|
|
- name: Create a VM
|
|
community.vmware.vmware_guest:
|
|
hostname: "{{ vcenter_hostname }}"
|
|
username: "{{ vcenter_username }}"
|
|
password: "{{ vcenter_password }}"
|
|
validate_certs: "{{ vcenter_validate_certs }}"
|
|
datacenter: "{{ vcenter_datacenter }}"
|
|
folder: "{{ vm_folder }}"
|
|
name: "{{ vm_name }}"
|
|
state: poweredon
|
|
guest_id: "{{ vm_guest_id }}"
|
|
datastore: "{{ vm_datastore }}"
|
|
disk:
|
|
- size_gb: 4
|
|
type: thin
|
|
datastore: " {{ vm_datastore }}"
|
|
hardware:
|
|
memory_mb: 1024
|
|
num_cpus: 1
|
|
networks:
|
|
- name: "{{ ipxe_net_name }}"
|
|
device_type: vmxnet3
|
|
delegate_to: localhost
|
|
register: gather_create_vm
|
|
|
|
- name: Set facts vm_macaddress
|
|
set_fact:
|
|
vm_macaddress: "{{ gather_create_vm.instance.hw_eth0.macaddress }}"
|
|
delegation: localhost
|
|
|
|
- name: Set facts vm iface num
|
|
set_fact:
|
|
vm_iface_num: "{{ gather_create_vm.instance.advanced_settings['ethernet0.pciSlotNumber'] }}"
|
|
delegation: localhost
|
|
|
|
- name: Set facts vm_name_shot
|
|
set_fact:
|
|
vm_name_shot: "{{ vm_name.split('.')[0] }}"
|
|
delegation: localhost
|
|
|
|
|
|
#debug#- name: Debug
|
|
#debug# debug:
|
|
#debug# msg: "{{ gather_create_vm }}"
|
|
#debug#- name: Debug
|
|
#debug# debug:
|
|
#debug# msg: "ens + {{ vm_iface_num }} // {{ vm_macaddress }}"
|
|
|
|
|
|
|
|
|