# Exposing the Arista eos session for config validation

**URL:** <https://forum.ansible.com/t/exposing-the-arista-eos-session-for-config-validation/32000>\
**Category:** Ansible Developer\
**Created:** [January 17, 2020, 7:02pm UTC](https://forum.ansible.com/t/exposing-the-arista-eos-session-for-config-validation/32000 "2020-01-17T19:02:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sean\_M\_Collins](https://avatars.discourse-cdn.com/v4/letter/s/47e85d/32.png) [@Sean\_M\_Collins](https://forum.ansible.com/u/Sean_M_Collins)\
**Post date:** [January 17, 2020, 7:02pm UTC](https://forum.ansible.com/t/exposing-the-arista-eos-session-for-config-validation/32000/1 "2020-01-17T19:02:08Z")

</div>

Is there a way to get a handle for the session that Ansible uses, when  
connecting to Arista switches to run commands? I am trying to build some  
config validation/testing into a continuous integration pipeline with  
Batfish.

Batfish ([https://www.batfish.org/](https://www.batfish.org/)) however expects a full configuration  
file that it can load and parse[1], and I have spent some time in the  
Batfish slack discussing my use case with them. The main problem is that  
I use a number of Ansible modules, and I don't see a way to use these  
roles and render a full config that Batfish can consume, prior to it  
being pushed to the router and impacting the dataplane forwarding.

I have a couple Arista EOS+ roles that I utilize:

\* arista.eos-bgp  
\* arista.eos-route-control  
\* arista.eos-mlag  
\* arista.eos-virtual-router

As well as many of the built in modules, such as:

\* eos\_l2\_interface  
\* eos\_l3\_interface  
\* eos\_linkagg  
\* eos\_vlan

Ideally, I'd like some way to have an Ansible playbook where I have  
these roles apply inside an eos session, then have some tasks in the  
playbook that executes the Batfish validation, and if it succeeds,  
commit it to running-config[2]. If it fails, discard the session and do  
not modify running-config.

If there was a way to expose the session that the `network_cli` plugin  
already establishes[3], in a way that I could hold on to that reference,  
that would be great. I looked into building vEOS instances in OpenStack  
but never could get it working reliably enough where I could run  
playbooks against the vEOS instances and then have Batfish pull the  
configs off to evaluate.

Or perhaps another idea?

Thanks!

[1]: [https://batfish-org.slack.com/archives/C8XKQNHAQ/p1568143599057800?thread\_ts=1567104609.045100&cid=C8XKQNHAQ](https://batfish-org.slack.com/archives/C8XKQNHAQ/p1568143599057800?thread_ts=1567104609.045100&cid=C8XKQNHAQ)

[2]: [https://www.arista.com/en/um-eos/eos-section-2-5-session-management-commands#ww1217237](https://www.arista.com/en/um-eos/eos-section-2-5-session-management-commands#ww1217237)

[3]: [https://github.com/ansible/ansible/blob/50e09be14f0b055440a3b7df7ed916c8c24bdae2/lib/ansible/plugins/cliconf/eos.py#L92](https://github.com/ansible/ansible/blob/50e09be14f0b055440a3b7df7ed916c8c24bdae2/lib/ansible/plugins/cliconf/eos.py#L92)

--- transcript - if slack archive deletes
