Description
SUMMARY
I'm trying to create a VM in a VSphere (VMC) environment leveraging NSX-T. The VM is being created without a network card. I've narrowed out down to this line in the configure_networks function:
community.vmware/plugins/modules/vmware_guest.py
Line 2060 in 4a248de
Using a relospec when configuring opaque networks causes the network card to either not be added to the VM, or the network card will be permanently disconnected. Changing the line to use a configspec will cause the network card to be added and configured successfully.
Is anyone aware of the history for why a relospec was used specifically for when the network is opaque? There is a comment above the line that indicates this might be a known issue.
ISSUE TYPE
- Bug Report
COMPONENT NAME
vmware_guest
ANSIBLE VERSION
2.9.18
OS / ENVIRONMENT
ansible running on CentOS 8.3
STEPS TO REPRODUCE
The playbook below will create a VM without a network card:
- name: Create Centos 8 Template
community.vmware.vmware_guest:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: "{{ datacenter_name }}"
folder: "{{ workload_folder }}"
name: "{{ template_centos_8 }}"
state: present
guest_id: centos8_64Guest
hardware:
memory_mb: 8192
num_cpus: 2
num_cpu_cores_per_socket: 1
version: 14
scsi: lsilogicsas
boot_firmware: efi
disk:
- size_gb: 100
type: thin
datastore: "{{ workload_datastore }}"
networks:
- name: "{{ network_name }}"
type: dhcp
device_type: e1000e
resource_pool: "{{ resource_pool }}"
register: create_centos_8_template
Changing the relospec to a configspec in the above-referenced line will cause the network to be created/configured successfully.
EXPECTED RESULTS
The network card should be added to the VM and configured as per the playbook configuration.
ACTUAL RESULTS
The VM is created without a network card