CiscoDevNet / ansible-dcnm

Apache License 2.0
45 stars 36 forks source link

module error when deploy second vrf using state=overridden #232

Closed dsx1123 closed 1 year ago

dsx1123 commented 1 year ago

Community Note

Ansible Version and collection version

ansible [core 2.12.2]
  config file = /root/.ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /root/virtualenv/ansible/lib/python3.11/site-packages/ansible
  ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
  executable location = /root/virtualenv/ansible/bin/ansible
  python version = 3.11.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.0]
  jinja version = 3.1.2
  libyaml = True

DCNM version

Affected module(s)

Ansible Playbook

# Copy-paste your ansible playbook here
---
- name: vrf overridden
  hosts: ndfc2
  vars:
    fabric: fabric_stage
    vrf_config:
      - vrf_name: vrf_green
        vrf_id: 51011
        attach:
          - ip_address: 192.168.123.101
            deploy: false
          - ip_address: 192.168.123.102
            deploy: false
     # vrf_blue is added after the first run
      - vrf_name: vrf_blue
        vrf_id: 51012
        attach:
          - ip_address: 192.168.123.101
            deploy: false
          - ip_address: 192.168.123.102
            deploy: false
  tasks:

    - name: overridden vrfs
      cisco.dcnm.dcnm_vrf:
        fabric: "{{ fabric}}"
        state: overridden
        config: "{{ vrf_config }}"
      tags:
        - vrf
        - overlay

Debug Output

https://gist.github.com/dsx1123/e929659048986aa6ff58478bd7d3657c

Expected Behavior

The second vrfs should be created

Actual Behavior

module error

Steps to Reproduce

  1. create first vrf vrf_green using playbook
  2. attach the vrf to switch and deploy
  3. add second vrf vrf_blue to the playbook and re-run the playbook

References

the issue might be related to #230, And if set deploy=true, the issue is not seen.

praveenramoorthy commented 1 year ago

Fixed as part of #233