cancel
Showing results for 
Search instead for 
Did you mean: 

EXOS configuration scripting tool

EXOS configuration scripting tool

Anonymous
Not applicable
Hi,

Going to throw this out there in the hope the community has some ideas.

I often find myself building configs with a lot of repative configuration statements, so was looking for a means of automating this.

Have played a little with python, but I'm very new to it so can't quit adopt it for use.

Found this article https://codingnetworker.com/2015/09/configuration-generator-with-python-and-jinja2/ where I changed the config to match EXOS and used a CSV file to fill in the parameters:

create vlan "{{ vlan-name }}"
configure vlan {{ vlan-name }} tag {{ vlan-number }}
configure vlan {{ vlan-name }} add ports 1:29,1:34 tagged
configure vlan {{ vlan-name }} ipaddress {{ vlan-ip }} 255.255.255.0
enable ipforwarding vlan {{ vlan-name }}
configure elrp-client periodic {{ vlan-name }} ports 61,1 interval 1 log-and-trap disable-port ingress permanent
enable bootprelay ipv4 vlan {{ vlan-name }}
create vrrp vlan {{ vlan-name }} vrid 1
configure vrrp vlan {{ vlan-name }} vrid 1 add {{ vlan-vip }}
configure vrrp vlan {{ vlan-name }} vrid 1 priority 150
enable vrrp vlan {{ vlan-name }} vrid 1
configure ospf vlan {{ vlan-name }} priority 0
configure ospf add vlan {{ vlan-name }} area 0.0.0.0 passive
This worked fine, except the elements above I need to repeat for every parameter listed. For example I might have 100 'vlan-name', 'vlan-number', 'vlan-ip' etc

So I need it to cyclic through each of the parameters and stop when finished. Although the article details the use of JSON which might do the trick, the preparation of that file would take too long. Whereas the creation of a CSV file with all the details in would be much easier and quicker to create.

Perhaps there is an easier way to do it, or something that already exits?

Look forward to any answers.

Thanks in advance

12 REPLIES 12

Lindsay_Hill
Extreme Employee
FYI, exos_command, exos_config and exos_facts are now all in the current shipping GA version of Ansible (2.7). It was published earlier this month.

Tim_Black
New Contributor II
Martin, I wonder if you've since considered using the relatively new support for EXOS switches in Ansible. Currently, Ansible 2.6 includes only the exos_command module, but it looks like an exos_config module will soon follow, which is exactly what you were asking for, since Ansible uses jinja2 templates. For now, I am choosing to use the more mature and versatile JSONRPC interface to do the same thing.

Tim_Black
New Contributor II
Hi Martin, I've been working towards introducing Ansible at my company for machine configuration management, where machine typically has meant development workstations and servers, native/bare-metal, virtual, or containerized. But from Ansible's perspective, it can work on anythings with ssh and python. I've not used Ansible for switch provisioning, but am intrigued by it, moving forward.

Others at my company have used telnet CLI via python to control these, and I'm now more interested in JSONRPC bc of all the IO handling/parsing it does automatically. We are not a data center type application - we are doing product testing and I'm adding the ability to our test infrastructure to set up, use, and tear down various network topologies via python. You can call Ansible from python application (since Ansible itself is python code) but for our purpose I feel the integration with JSONRPC will be much simpler and can achieve the same things.

The main thing Ansible can do that JSONRPC approach does not (out of the box, anyway) is parallelism and idempotency for you so you can run the same playbook on 100 switches and it will be fast and will only do anything if it determines it needs to. Depending on what you're using these switches for, this may/may not be useful. Cheers!

Anonymous
Not applicable
Hi Tim,

Thanks for posting and no, I hadn't! That is a very intriguing idea!

Not seen or used Ansible before but going to start looking into now.

The python scripting I use works extremely well, and probably shaves days of large projects. This issue with it, is that its not very user friendly i.e. I've gotten to understand it well, but when I pass it on other engineers they don't bother using it because setting it up and interfacing is a little complicated - and it would seem Ansible could have the answer to this.

If I do get to use it I'll post back my experience.

Thanks,

Martin
GTM-P2G8KFN