ansible-collections / community.vmware

Ansible Collection for VMware
GNU General Public License v3.0
337 stars 332 forks source link

vmware_dvswitch_pvlans Returns spec.pvlanConfigSpec error #1505

Open satria0123 opened 1 year ago

satria0123 commented 1 year ago
SUMMARY

Cannot create PVLAN. Executing the playbook returns fatal: [localhost]: FAILED! => {"changed": false, "msg": "Failed to update DVS : ('A specified parameter was not correct: spec.pvlanConfigSpec', None)"}

ISSUE TYPE
COMPONENT NAME

community.vmware.vmware_dvswitch_pvlans

ANSIBLE VERSION
ansible [core 2.13.5]
  config file = None
  configured module search path = ['/Users/fauzanimursyid/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /opt/homebrew/lib/python3.9/site-packages/ansible
  ansible collection location = /Users/fauzanimursyid/.ansible/collections:/usr/share/ansible/collections
  executable location = /opt/homebrew/bin/ansible
  python version = 3.9.7 (default, Oct 22 2021, 13:24:00) [Clang 13.0.0 (clang-1300.0.29.3)]
  jinja version = 3.1.2
  libyaml = True
COLLECTION VERSION

# /opt/homebrew/lib/python3.9/site-packages/ansible_collections
Collection       Version
---------------- -------
community.vmware 2.10.0 

# /Users/fauzanimursyid/.ansible/collections/ansible_collections
Collection       Version
---------------- -------
community.vmware 3.0.0  
CONFIGURATION
no output
OS / ENVIRONMENT

Macbook Air M1 macOS Monterey 12.3.1

STEPS TO REPRODUCE

Error occurs everytime running this pvlan-playbook.yaml below:

---
- hosts: localhost
  gather_facts: false
  connection: local
  vars:
      vcenter_server: "X.X.X.X"
      vcenter_user: "X@X.X"
      vcenter_pass: "X"
      vcenter_validate_certs: false
  tasks:
  - name: DSwitch
    vmware_dvswitch_pvlans:
      hostname: "{{ vcenter_server }}"
      username: "{{ vcenter_user }}"
      password: "{{ vcenter_pass }}"
      validate_certs: "{{ vcenter_validate_certs }}"
      switch: DSwitch
      primary_pvlans:
        - primary_pvlan_id: 544
      secondary_pvlans:
        - primary_pvlan_id: 544
          secondary_pvlan_id: 547
          pvlan_type: community
    delegate_to: localhost
EXPECTED RESULTS

Create primary PVLAN 544 and secondary PVLAN 547 in VMWare

ACTUAL RESULTS
 ~ % ansible-playbook pvlan-playbook.yaml           
[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 [localhost] *******************************************************************************************************************************************************************************************

TASK [DSwitch] *********************************************************************************************************************************************************************************************
fatal: [localhost]: FAILED! => {"changed": false, "msg": "Failed to update DVS : ('A specified parameter was not correct: spec.pvlanConfigSpec', None)"}

PLAY RECAP *************************************************************************************************************************************************************************************************
localhost                  : ok=0    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0   
ansibullbot commented 1 year ago

Files identified in the description: None

If these files are inaccurate, please update the component name section of the description or use the !component bot command.

click here for bot help

mariolenz commented 1 year ago

@satria0123 Sorry, I can't reproduce this. Your playbook works in my environment.

What's the current state of the switch, are there any PVLANs already defined and you're trying to add or change them? I've only tested with a fresh switch that hadn't any PVLANs defined yet and, as said above, this worked for me.