Skip to content

Guest Module does not work on VMWare Cloud on AWS (VMC) after change from NVDS to VDS #1384

Open
@skain80

Description

@skain80
SUMMARY

Module does not work on VMWare Cloud on AWS after change from NVDS to VDS

"msg": "Failed to find distributed virtual switch which is associated with distributed virtual portgroup 'NONPROD'. Make sure hostsystem is associated with the given distributed virtual portgroup. Also, check if user has correct permission to access distributed virtual switch in the given portgroup."

My guess is this change: https://kb.vmware.com/s/article/82487

ISSUE TYPE
  • Bug Report
COMPONENT NAME

https://github.com/ansible-collections/community.vmware/blob/main/plugins/modules/vmware_guest.py#L1872

ANSIBLE VERSION
2 skain@archibald ~/git/ansible % ansible --version
ansible [core 2.13.1]
  config file = /home/skain/git/ansible/ansible.cfg
  configured module search path = ['/home/skain/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/skain/git/ansible/venv/lib/python3.10/site-packages/ansible
  ansible collection location = /home/skain/.ansible/collections:/usr/share/ansible/collections
  executable location = /home/skain/git/ansible/venv/bin/ansible
  python version = 3.10.5 (main, Jun  6 2022, 18:49:26) [GCC 12.1.0]
  jinja version = 3.1.2
  libyaml = True
skain@archibald ~/git/ansible % 
COLLECTION VERSION
skain@archibald ~/git/ansible % ansible-galaxy collection list community.general

# /home/skain/git/ansible/venv/lib/python3.10/site-packages/ansible_collections
Collection        Version
----------------- -------
community.general 5.0.2  
skain@archibald ~/git/ansible % ansible-galaxy collection list community.vmware 

# /home/skain/git/ansible/venv/lib/python3.10/site-packages/ansible_collections
Collection       Version
---------------- -------
community.vmware 2.6.0  
CONFIGURATION

OS / ENVIRONMENT

Target SDDC Version: 1.16v5

(it still works with SDDC Version: 1.16v4)

STEPS TO REPRODUCE
---
- name: make vmc vm
  hosts: localhost
  connection: local
  gather_facts: no
  become: no
  
  tasks:
  - name: vm in SDDC
    community.vmware.vmware_guest:
      datacenter: SDDC-Datacenter
      cluster: Cluster-1
      #esxi_hostname: 10.144.130.5
      hostname: x.x.x.x
      username: x.x.x.x
      password: xxxxxx
      folder: /SDDC-Datacenter/vm/Workloads
      name: test_vm_0001
      state: "{{ state }}"
      #resource_pool: Compute-ResourcePool
      validate_certs: false
      guest_id: centos64Guest
      #template: centos7-template-2022-02-24
      disk:
      - size_gb: 10
        type: thin
        datastore: WorkloadDatastore
      hardware:
        memory_mb: 512
        num_cpus: 4
      networks:
      - name: NONPROD
        ip: x.x.x.x
        netmask: 255.255.255.0
      wait_for_ip_address: false
    delegate_to: localhost
    register: deploy_vm
    changed_when: false
    tags:
    - euw3
EXPECTED RESULTS
skain@archibald ~/git/ansible % ansible-playbook -l localhost vmprov.yaml -e "state=poweredoff" --tags euc1      
[WARNING]: No inventory was parsed, only implicit localhost is available
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'

PLAY [make vmc vm] ***********************************************************************************************************************************************************************************************

TASK [vm in EUC1] ************************************************************************************************************************************************************************************************
ok: [localhost]

PLAY RECAP *******************************************************************************************************************************************************************************************************
localhost                  : ok=1    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   
ACTUAL RESULTS
skain@archibald ~/git/ansible % ansible-playbook -l localhost vmprov.yaml -e "state=poweredoff" --tags euw3
[WARNING]: No inventory was parsed, only implicit localhost is available
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'

PLAY [make vmc vm] ***********************************************************************************************************************************************************************************************

TASK [vm in EUW3] ************************************************************************************************************************************************************************************************
fatal: [localhost]: FAILED! => {"changed": false, "msg": "Failed to find distributed virtual switch which is associated with distributed virtual portgroup 'NONPROD'. Make sure hostsystem is associated with the given distributed virtual portgroup. Also, check if user has correct permission to access distributed virtual switch in the given portgroup."}

PLAY RECAP *******************************************************************************************************************************************************************************************************
localhost                  : ok=0    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0   

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue/PR relates to a bugneeds_triageNeeds a first human triage before being processed.python3

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions