Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

dcnm_inventory state merged is not idempotent #86

Closed
gve-vse-tim opened this issue Jul 30, 2021 · 3 comments
Closed

dcnm_inventory state merged is not idempotent #86

gve-vse-tim opened this issue Jul 30, 2021 · 3 comments
Labels
bug Something isn't working

Comments

@gve-vse-tim
Copy link

Community Note

  • Please vote on this issue by adding a 馃憤 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Ansible Version and collection version

Ansible: 2.10.4

Ansible Collection: cisco.dcnm = 1.2.0

Python modules

  • ansible-base 2.10.4
  • ansible 2.10.5

DCNM version

DCNM LAN Fabric: 11.5.1

Affected module(s)

  • dcnm_inventory

Ansible Playbook

- hosts: dcnm
  gather_facts: false
  connection: ansible.netcommon.httpapi

  collections:
    - cisco.dcnm

  vars:
    ansible_command_timeout: 1800
    ansible_connect_timeout: 1800
    switch_username: USERNAME
    switch_password: PASSWORD
    site1_vxlan: VXLAN-Site1
    site1_bgw1: 1.1.3.1
    site1_bgw2: 1.1.3.2
    site2_vxlan: VXLAN-Site2
    site2_bgw1: 2.1.3.1
    site2_bgw2: 2.1.3.2

  tasks:
    - name: Add Border Gateways to "{{ site1_vxlan }}"
      dcnm_inventory:
        fabric: "{{ site1_vxlan }}"
        state: merged
        config:
          - seed_ip: "{{ site1_bgw1 }}"
            max_hops: 0
            preserve_config: false
            role: border_gateway
            auth_proto: MD5
            user_name: "{{ switch_username }}"
            password: "{{ switch_password }}"
          - seed_ip: "{{ site1_bgw2 }}"
            max_hops: 0
            preserve_config: false
            role: border_gateway
            auth_proto: MD5
            user_name: "{{ switch_username }}"
            password: "{{ switch_password }}"

Debug Output

# First run 
% ansible-playbook 01-vxlan_fabric_switches.yaml 

PLAY [dcnm] **********************************************************************************************************

TASK [Add Border Gateways to "VXLAN-Site1"] **************************************************************************
[WARNING]: Adding switches to a VXLAN fabric can take a while.  Please be patient...
changed: [dcpod_dcnm]

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

# Second run
(ansible-2.10) timmil@TIMMIL-M-842A ansible-dcnm-examples % ansible-playbook 01-vxlan_fabric_switches.yaml 

PLAY [dcnm] **********************************************************************************************************

TASK [Add Border Gateways to "VXLAN-Site1"] **************************************************************************
[WARNING]: Adding switches to a VXLAN fabric can take a while.  Please be patient...
fatal: [dcpod_dcnm]: FAILED! => {"changed": false, "msg": {"DATA": "Invalid JSON response: The IP is already in inventory: [/10.60.66.131]\n\nDiscovery Failed. \n\nPlease resolve selections and try again.", "MESSAGE": "Internal Server Error", "METHOD": "POST", "REQUEST_PATH": "https://172.18.180.190:443/rest/control/fabrics/VXLAN-Site1/inventory/discover?gfBlockingCall=true", "RETURN_CODE": 500}}

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

Expected Behavior

  • First run should have completed successfully, taking a great deal of time.
  • Second run should have completed with a task status of "ok".
  • Second run should have completed much more QUICKLY.

Actual Behavior

  • Second run failed as reported in the "debug" info above.
  • Second run took a decent amount of time to fail despite have a short list of attributes to check/compare. Although, in fairness, maybe because I'm doing 2 switches?
  • Second run actually fails because it made a REST call that was not correct - rather than detecting no changes were needed.

Steps to Reproduce

Simply run ansible-playbook 01-vxlan_fabric_switches.yaml (YAML copied above) multiple times.

References

@mikewiebe
Copy link
Collaborator

@gve-vse-tim We just merged the fix for this issue (#89). Can you re-try in your setup and let us know if it resolves the problem you are seeing

@gve-vse-tim
Copy link
Author

@mikewiebe Tested it this past week and all seems fine. Thanks for the fix!

@mikewiebe
Copy link
Collaborator

Fix now available in 2.0.0 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants