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

eos_eapi doesn't enable non-default vrfs if the default vrf is already configured #32111

Closed
dathelen opened this issue Oct 25, 2017 · 4 comments · Fixed by #32112
Closed

eos_eapi doesn't enable non-default vrfs if the default vrf is already configured #32111

dathelen opened this issue Oct 25, 2017 · 4 comments · Fixed by #32112
Assignees
Labels
affects_2.4 This issue/PR affects Ansible v2.4 bug This issue/PR relates to a bug. module This issue/PR relates to a module. networking Network category support:network This issue/PR relates to code supported by the Ansible Network Team.
Milestone

Comments

@dathelen
Copy link
Contributor

dathelen commented Oct 25, 2017

ISSUE TYPE
  • Bug Report
COMPONENT NAME

eos_eapi

ANSIBLE VERSION
ansible 2.4.0.0
  config file = /Users/dt/eosplus/eos-ansible-tower-demo/ansible.cfg
  configured module search path = [u'/Users/dt/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python2.7/site-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 2.7.11 (default, Nov 13 2016, 20:35:45) [GCC 4.2.1 Compatible Apple LLVM 7.3.0 (clang-703.0.31)]
CONFIGURATION

n/A

OS / ENVIRONMENT

N/A

SUMMARY

When a eos device has the eapi feature configured in the default vrf (i.e the running config has this):

skinny...04:51:06(config)#show run section api
!
management api http-commands
   no shutdown

When you run the following task:

 tasks:
    - name: enable api in non-default vrf
      eos_eapi:
          provider: "{{ provider }}"
          state: started
          vrf: management

The non-default vrf doesn't get the 'no shutdown' command

so you end up with a state like this:

changed: [cd262.sjc.aristanetworks.com] => {
    "ansible_facts": {
        "eos_eapi_urls": {
            "Management1": [
                "https://172.28.160.178:443"
            ],
            "Vlan300": [
                "https://1.1.1.253:443"
            ]
        }
    },
    "changed": true,
    "commands": [
        "management api http-commands",
        "vrf management"
    ],

On the switch there is only the default one remains, since the command sent via ansible does not no shut the non-default vrf.

STEPS TO REPRODUCE
---
- hosts: cd262.sjc.aristanetworks.com
  gather_facts: no
  connection: local
  vars:
      run_commands:
          - 'show running-config'

  tasks:
    - name: eapi non-default vrf
      eos_eapi:
          provider: "{{ provider }}"
          state: started
          vrf: management
EXPECTED RESULTS

The play should send a no shutdown command for the non-default vrf

ACTUAL RESULTS
00:54:32 [dt:~/eosplus/eos-ansible-tower-demo] master(+53/-32)+* ± ansible-playbook -i hosts run_commands.yaml -vvv
ansible-playbook 2.4.0.0
  config file = /Users/dt/eosplus/eos-ansible-tower-demo/ansible.cfg
  configured module search path = [u'/Users/dt/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python2.7/site-packages/ansible
  executable location = /usr/local/bin/ansible-playbook
  python version = 2.7.11 (default, Nov 13 2016, 20:35:45) [GCC 4.2.1 Compatible Apple LLVM 7.3.0 (clang-703.0.31)]
Using /Users/dt/eosplus/eos-ansible-tower-demo/ansible.cfg as config file
Parsed /Users/dt/eosplus/eos-ansible-tower-demo/hosts inventory source with ini plugin

PLAYBOOK: run_commands.yaml ************************************************************************************************************************************************
1 plays in run_commands.yaml

PLAY [cd262.sjc.aristanetworks.com] ****************************************************************************************************************************************
META: ran handlers

TASK [Run Specified Commands] **********************************************************************************************************************************************
task path: /Users/dt/eosplus/eos-ansible-tower-demo/run_commands.yaml:10
<cd262.sjc.aristanetworks.com> using connection plugin network_cli
Using module file /usr/local/lib/python2.7/site-packages/ansible/modules/network/eos/eos_eapi.py
<cd262.sjc.aristanetworks.com> ESTABLISH LOCAL CONNECTION FOR USER: dt
<cd262.sjc.aristanetworks.com> EXEC /bin/sh -c 'echo ~ && sleep 0'
<cd262.sjc.aristanetworks.com> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /Users/dt/.ansible/tmp/ansible-tmp-1508907283.99-63067192211963 `" && echo ansible-tmp-1508907283.99-63067192211963="` echo /Users/dt/.ansible/tmp/ansible-tmp-1508907283.99-63067192211963 `" ) && sleep 0'
<cd262.sjc.aristanetworks.com> PUT /var/folders/vw/2_f0pb_s40z3gxbzqs3s55980000gp/T/tmpyiZlmK TO /Users/dt/.ansible/tmp/ansible-tmp-1508907283.99-63067192211963/eos_eapi.py
<cd262.sjc.aristanetworks.com> EXEC /bin/sh -c 'chmod u+x /Users/dt/.ansible/tmp/ansible-tmp-1508907283.99-63067192211963/ /Users/dt/.ansible/tmp/ansible-tmp-1508907283.99-63067192211963/eos_eapi.py && sleep 0'
<cd262.sjc.aristanetworks.com> EXEC /bin/sh -c 'python /Users/dt/.ansible/tmp/ansible-tmp-1508907283.99-63067192211963/eos_eapi.py; rm -rf "/Users/dt/.ansible/tmp/ansible-tmp-1508907283.99-63067192211963/" > /dev/null 2>&1 && sleep 0'
changed: [cd262.sjc.aristanetworks.com] => {
    "ansible_facts": {
        "eos_eapi_urls": {
            "Management1": [
                "https://172.28.160.178:443"
            ],
            "Vlan300": [
                "https://1.1.1.253:443"
            ]
        }
    },
    "changed": true,
    "commands": [
        "management api http-commands",
        "vrf management"
    ],
    "failed": false,
    "invocation": {
        "module_args": {
            "auth_pass": null,
            "authorize": null,
            "config": null,
            "host": "cd262.sjc.aristanetworks.com",
            "http": null,
            "http_port": null,
            "https": null,
            "https_port": null,
            "local_http": null,
            "local_http_port": null,
            "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "port": null,
            "provider": {
                "auth_pass": null,
                "authorize": null,
                "host": "cd262.sjc.aristanetworks.com",
                "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
                "port": null,
                "ssh_keyfile": null,
                "timeout": null,
                "transport": "cli",
                "use_ssl": true,
                "username": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
                "validate_certs": false
            },
            "socket": null,
            "ssh_keyfile": null,
            "state": "started",
            "timeout": null,
            "transport": "cli",
            "use_ssl": true,
            "username": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "validate_certs": false,
            "vrf": "management"
        }
    },
    "session_name": "ansible_1508907284"
@ansibot
Copy link
Contributor

ansibot commented Oct 25, 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 support:network This issue/PR relates to code supported by the Ansible Network Team. labels Oct 25, 2017
@dathelen
Copy link
Contributor Author

looks like the check on whether the no shutdown command is entered needs to see if the current vrf is the one that the user is trying to enable as well

@gundalow
Copy link
Contributor

resolved_by_pr: 32112

@gundalow gundalow removed the needs_triage Needs a first human triage before being processed. label Oct 25, 2017
@gundalow gundalow modified the milestones: 2.4.0, 2.5.0 Oct 25, 2017
caphrim007 pushed a commit to caphrim007/ansible that referenced this issue Nov 1, 2017
…e#32111 (ansible#32112)

* adding the desired state config to the new vrf fixes ansible#32111

* fix default vrf initial configured

* add unit test
ganeshrn pushed a commit to ganeshrn/ansible that referenced this issue Nov 1, 2017
…e#32111 (ansible#32112)

* adding the desired state config to the new vrf fixes ansible#32111

* fix default vrf initial configured

* add unit test

* Update CHANGELOG

(cherry picked from commit 2c99cbc)
ganeshrn pushed a commit to ganeshrn/ansible that referenced this issue Nov 1, 2017
…e#32111 (ansible#32112)

* adding the desired state config to the new vrf fixes ansible#32111

* fix default vrf initial configured

* add unit test

* Update CHANGELOG

(cherry picked from commit 2c99cbc)
@ganeshrn
Copy link
Member

ganeshrn commented Nov 1, 2017

Fix will be available in 2.4.2beta2 release

ganeshrn added a commit that referenced this issue Nov 1, 2017
…#32112) (#32452)

* adding the desired state config to the new vrf fixes #32111

* fix default vrf initial configured

* add unit test

* Update CHANGELOG

(cherry picked from commit 2c99cbc)
@ansibot ansibot added bug This issue/PR relates to a bug. and removed bug_report labels Mar 7, 2018
@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. module This issue/PR relates to a module. networking Network category support:network This issue/PR relates to code supported by the Ansible Network Team.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants