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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nxos_evpn_vni state present not working #24995

Closed
ghost opened this issue May 24, 2017 · 9 comments · Fixed by #25212
Closed

nxos_evpn_vni state present not working #24995

ghost opened this issue May 24, 2017 · 9 comments · Fixed by #25212
Assignees
Labels
affects_2.4 This issue/PR affects Ansible v2.4 bug This issue/PR relates to a bug. cisco Cisco technologies module This issue/PR relates to a module. networking Network category nxos Cisco NXOS community

Comments

@ghost
Copy link

ghost commented May 24, 2017

ISSUE TYPE
  • Bug Report
COMPONENT NAME

nxos_evpn_vni

ANSIBLE VERSION
ansible 2.4.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.5 (default, Nov  6 2016, 00:28:07) [GCC 4.8.5 20150623 (Red Hat 4.8.5-11)]

CONFIGURATION
OS / ENVIRONMENT

RHEL 7.2

SUMMARY

Setting evpn configs as state:absent. Ansible outputs "ok" not "changed". Checked NxOS and configs were not deleted.

STEPS TO REPRODUCE
      - name: Ensure EVPN is not on device
        nxos_evpn_vni:
          vni: "{{ vnid }}"
          username: un
          password: pwd
          host: "{{ item }}"
          state: absent
          transport: cli
        with_items:
          - "{{ leaf1ip }}"
          - "{{ leaf2ip }}"
          - "{{ leaf3ip }}"
          - "{{ leaf4ip }}"
        register: delevpn
        ignore_errors: yes
EXPECTED RESULTS
changed: [localhost] => (item=leaf1)
changed: [localhost] => (item=leaf2)
changed: [localhost] => (item=leaf3)
changed: [localhost] => (item=leaf4)

expected configs deleted when playbook is ran

ACTUAL RESULTS

output below is the same for the four items

<127.0.0.1> connection transport is cli
<> using connection plugin network_cli
<> socket_path: /root/.ansible/pc/531159983e
open_shell() returned 0 ok
Using module file /usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_evpn_vni.py
<127.0.0.1> EXEC /bin/sh -c 'echo ~ && sleep 0'
<127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /root/.ansible/tmp/ansible-tmp-1495645321.48-36455347467130 `" && echo ansible-tmp-1495645321.48-36455347467130="` echo /root/.ansible/tmp/ansible-tmp-1495645321.48-36455347467130 `" ) && sleep 0'
<127.0.0.1> PUT /tmp/tmp10V3Dw TO /root/.ansible/tmp/ansible-tmp-1495645321.48-36455347467130/nxos_evpn_vni.py
<127.0.0.1> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-tmp-1495645321.48-36455347467130/ /root/.ansible/tmp/ansible-tmp-1495645321.48-36455347467130/nxos_evpn_vni.py && sleep 0'
<127.0.0.1> EXEC /bin/sh -c '/usr/bin/python /root/.ansible/tmp/ansible-tmp-1495645321.48-36455347467130/nxos_evpn_vni.py; rm -rf "/root/.ansible/tmp/ansible-tmp-1495645321.48-36455347467130/" > /dev/null 2>&1 && sleep 0'
ok: [localhost] => (item=) => {
    "changed": false,
    "commands": [],
    "invocation": {
        "module_args": {
            "config": null,
            "host": "",
            "include_defaults": "True",
            "password": "",
            "port": null,
            "provider": null,
            "route_distinguisher": null,
            "route_target_both": null,
            "route_target_export": null,
            "route_target_import": null,
            "save": false,
            "ssh_keyfile": null,
            "state": "absent",
            "timeout": 10,
            "transport": "cli",
            "use_ssl": null,
            "username": "",
            "validate_certs": null,
            "vni": "5304"
        }
    },
    "item": "",
    "warnings": [
        "argument username has been deprecated and will be removed in a future version",
        "argument host has been deprecated and will be removed in a future version",
        "argument password has been deprecated and will be removed in a future version"
    ]
}

@ghost
Copy link
Author

ghost commented May 24, 2017

@trishnaguha

@ansibot
Copy link
Contributor

ansibot commented May 24, 2017

@ansibot ansibot added affects_2.4 This issue/PR affects Ansible v2.4 bug_report module This issue/PR relates to a module. needs_triage Needs a first human triage before being processed. networking Network category labels May 24, 2017
@trishnaguha
Copy link
Member

@donsantos Can you please make sure that the config is already present on your device or not?

@ansibot ansibot removed the needs_triage Needs a first human triage before being processed. label May 24, 2017
@ghost
Copy link
Author

ghost commented May 24, 2017

@trishnaguha
this is the config for creating it and output

    - name: Configure EVPN
      nxos_evpn_vni:
        vni: "{{ vnid }}"
        route_distinguisher: auto
        route_target_import: auto
        route_target_export: auto
        username: un
        password: pwd
        host: "{{ item }}"
        state: present
        transport: cli
      with_items:
        - "{{ leaf1ip }}"
        - "{{ leaf2ip }}"
        - "{{ leaf3ip }}"
        - "{{ leaf4ip }}"
      register: evpnconfig
      ignore_errors: yes
changed: [localhost] => (item=) => {
    "changed": true,
    "commands": [
        "evpn",
        "vni 5304 l2"
    ],
    "invocation": {
        "module_args": {
            "config": null,
            "host": "",
            "include_defaults": "True",
            "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "port": null,
            "provider": null,
            "route_distinguisher": "auto",
            "route_target_both": null,
            "route_target_export": [
                "auto"
            ],
            "route_target_import": [
                "auto"
            ],
            "save": false,
            "ssh_keyfile": null,
            "state": "present",
            "timeout": 10,
            "transport": "cli",
            "use_ssl": null,
            "username": "",
            "validate_certs": null,
            "vni": "5304"
        }
    },
    "item": "",
    "warnings": [
        "argument username has been deprecated and will be removed in a future version",
        "argument host has been deprecated and will be removed in a future version",
        "argument password has been deprecated and will be removed in a future version"
    ]
}

After creation I ran nxos_evpn_vni with state: absent and received "ok" as the output

@trishnaguha
Copy link
Member

trishnaguha commented May 26, 2017

@donsantos state=absent is only supposed to work if config is present on your device, otherwise it would return false. Can you please make sure that you are configuring it right way?
You might want to look into the commit 6a3ce18 which may be useful.

@ghost
Copy link
Author

ghost commented May 30, 2017

@trishnaguha I checked and it looks like the playbook is creating the config, however its not setting rd auto and route target import/export auto.

@trishnaguha
Copy link
Member

trishnaguha commented May 31, 2017

@donsantos Thanks for the bug report. I have got it reproduced.
The underlying issue was related to state=present.
The referred PR #25212 should fix the issue. Can you please apply the patch and let us know?

@trishnaguha trishnaguha self-assigned this May 31, 2017
@trishnaguha trishnaguha changed the title nxos_evpn_vni state absent not working nxos_evpn_vni state present not working May 31, 2017
@ghost
Copy link
Author

ghost commented May 31, 2017

@trishnaguha Hi, applied and it worked. Thank you!

@trishnaguha
Copy link
Member

resolved_by_pr #25212

@ansibot ansibot added bug This issue/PR relates to a bug. and removed bug_report labels Mar 7, 2018
@dagwieers dagwieers added nxos Cisco NXOS community cisco Cisco technologies labels Feb 22, 2019
@ansible ansible locked and limited conversation to collaborators Apr 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.4 This issue/PR affects Ansible v2.4 bug This issue/PR relates to a bug. cisco Cisco technologies module This issue/PR relates to a module. networking Network category nxos Cisco NXOS community
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants