Skip to content

Instantly share code, notes, and snippets.

@IPvSean
Created April 24, 2018 07:42
Show Gist options
  • Save IPvSean/8c7d94312591caed5b9e0f679fe79c24 to your computer and use it in GitHub Desktop.
Save IPvSean/8c7d94312591caed5b9e0f679fe79c24 to your computer and use it in GitHub Desktop.
with network_cli and persistent ssh, each command is done in order, so the context is kept
---
- hosts: arista
connection: network_cli
tasks:
- eos_command:
commands:
- routing-context vrf blah
- show routing-context vrf
register: output
- debug:
var: output
@IPvSean
Copy link
Author

IPvSean commented Apr 24, 2018

the output is literally->

➜  ansible-napalm-samples git:(master) ✗ ansible-playbook vrf.yml

PLAY [arista] *************************************************************************************************************************

TASK [eos_command] ********************************************************************************************************************
ok: [eos]

TASK [debug] **************************************************************************************************************************
ok: [eos] => {
    "output": {
        "changed": false,
        "failed": false,
        "stdout": [
            "",
            "Current VRF routing-context is blah"
        ],
        "stdout_lines": [
            [
                ""
            ],
            [
                "Current VRF routing-context is blah"
            ]
        ]
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment