Skip to content

vmware_guest / network adapter disconnected when portgroup #2533

@nesies

Description

@nesies
SUMMARY

When i create a vm from a template, if i change the portgroup of the network adapter, it came disconnected.

If i do not set network or set the same portgroup, the adapter is connected at start

ISSUE TYPE
  • Bug Report
COMPONENT NAME

vmware_guest

ANSIBLE VERSION

COLLECTION VERSION
ansible-playbook [core 2.16.14]
  config file = /src/ansible.cfg
  configured module search path = ['/tmp/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /opt/app-root/venv/lib/python3.12/site-packages/ansible
  ansible collection location = /opt/app-root
  executable location = /opt/app-root/venv/bin/ansible-playbook
  python version = 3.12.12 (main, Nov 18 2025, 05:57:10) [GCC 12.2.0] (/opt/app-root/venv/bin/python3)
  jinja version = 3.1.6
  libyaml = True
ansible-galaxy collection list

# /opt/app-root/ansible_collections
Collection                         Version
---------------------------------- ------------------------
amazon.aws                         10.1.0
ansible.netcommon                  4.1.0
ansible.posix                      1.4.0
ansible.utils                      2.8.0
ansible.windows                    1.13.0
cody.bytel_rhel_centos_hardening   2024.2.26-5dev1-SNAPSHOT
cody.cody                          2025.12.9-1
commun.infra_account_from_aim_rest 1.0.8
commun.infra_camunda_api           1.0.17
commun.infra_commun                1.0.6
commun.infra_service_cmdb_api      1.0.10
community.crypto                   2.10.0
community.general                  11.0.0
community.kubernetes               2.0.1
community.mysql                    3.14.0
community.postgresql               4.1.0
community.vmware                   6.1.0
community.windows                  1.12.0
google.cloud                       1.0.2
infoblox.nios_modules              1.8.0
kubernetes.core                    2.3.2
servicenow.itsm                    2.13.2
servicenow.servicenow              1.0.6
theforeman.foreman                 3.8.0
vmware.vmware                      2.6.0
CONFIGURATION
ansible-config dump --only-changed
COLLECTIONS_PATHS(env: ANSIBLE_COLLECTIONS_PATH) = ['/opt/app-root']
CONFIG_FILE() = /src/ansible.cfg
OS / ENVIRONMENT

Customized docker image python:3.12

Template hadware version is: Compatibility ESXi 8.0 U2 and later (VM version 21)

VMware ESXi, 8.0.3, 24784735

STEPS TO REPRODUCE
   - name: Instance creation
      community.vmware.vmware_guest:
        hostname: "{{ vcenter_hostname }}"
        username: "{{ vcenter_username }}"
        password: "{{ vcenter_password }}"
        name: testvm
        state: powered-on
        validate_certs: false
        resource_pool: "{{ resource_pool }}"
        template: "{{ template }}"
        datacenter: "{{ datacenter }}"
        datastore: "{{ datastore }}"
        cluster: "{{ cluster }}"
        folder: "{{ folder }}"
        wait_for_customization: false
        wait_for_customization_timeout: 600
        wait_for_ip_address: false
        wait_for_ip_address_timeout: 300
        hardware:
          boot_firmware: bios
          hotadd_cpu: true
          hotadd_memory: true
          memory_mb: 4096
          num_cpus: 1
          nested_virt: false
        networks:
         - name: OTHER
           connected: true
           start_connected: true

-> network adpater is disconnected

Without the block network, adpater is connected

  - name: Instance creation
      community.vmware.vmware_guest:
        hostname: "{{ vcenter_hostname }}"
        username: "{{ vcenter_username }}"
        password: "{{ vcenter_password }}"
        name: testvm
        state: powered-on
        validate_certs: false
        resource_pool: "{{ resource_pool }}"
        template: "{{ template }}"
        datacenter: "{{ datacenter }}"
        datastore: "{{ datastore }}"
        cluster: "{{ cluster }}"
        folder: "{{ folder }}"
        wait_for_customization: false
        wait_for_customization_timeout: 600
        wait_for_ip_address: false
        wait_for_ip_address_timeout: 300
        hardware:
          boot_firmware: bios
          hotadd_cpu: true
          hotadd_memory: true
          memory_mb: 4096
          num_cpus: 1
          nested_virt: false
EXPECTED RESULTS

I would expect network adpater is connected when i change the portgroup

ACTUAL RESULTS

network adapter is disconnected when a change the portgroup

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions