quads icon indicating copy to clipboard operation
quads copied to clipboard

RFE: Use ansible networking for switch configuration

Open smalleni opened this issue 6 years ago • 6 comments
trafficstars

Ansible networking (https://docs.ansible.com/ansible/latest/network/index.html) is now being used in several very large production environments with network devices in the order of thousands. It has support for several major vendors such as cisco, juniper etc. It would be great to migrate current scripts that configure networking to use ansible networking.

smalleni avatar Jan 09 '19 20:01 smalleni

@kambiz-aghaiepour @grafuls @sadsfae @abondvt89 @jtaleric

smalleni avatar Jan 09 '19 20:01 smalleni

I don't think this is a terrible idea. Use git for change management (or gitlab)...

jtaleric avatar Jan 09 '19 21:01 jtaleric

Thanks for opening this @smalleni. We're working directly with @radez on getting this tested and implemented as he's working on Ansible Networking. Let's leave this open and use it to track the progress, probably this will happen in 1.2 or whereabouts roadmap-wise (Dan also will be using Scale Lab to test Ansible Networking features that will make it upstream).

sadsfae avatar Jan 15 '19 12:01 sadsfae

Update here: @radez gave us a wonderful deep-dive into the current status of Ansible-Networking and Networking-Ansible and where it is currently on our team call (link limited to Red Hat folks unfortunately)

https://bluejeans.com/s/kRj1M/

sadsfae avatar Feb 18 '19 12:02 sadsfae

Some more links here:

(proposed workflow) QUADS --> network-runner --> ansible-runner --> vendor switches

https://github.com/ansible-network/network-runner https://github.com/ansible/ansible-runner

sadsfae avatar Mar 21 '19 20:03 sadsfae

Code / example snippet of how this might work with network-runner ala @radez

from network_runner import api
from network_runner.resources.inventory import Inventory
from network_runner.resources.inventory.hosts import Host


h = Host(name='testhost',
         ansible_host='192.168.121.34',
         ansible_user='root',
         ansible_ssh_pass='Juniper',
         ansible_network_os='junos')
inv = Inventory()
inv.hosts.add(h)



hostname = 'testhost'
vlan = 37
port = 'xe-0/0/7'
t_vlans = [3,7,73]

net_runr = api.NetworkRunner(inv)
net_runr.create_vlan(hostname, vlan)
net_runr.conf_access_port(hostname, port, vlan)
net_runr.conf_trunk_port(hostname, port, vlan, t_vlans)
net_runr.delete_port(hostname, port)
net_runr.delete_vlan(hostname, vlan)

sadsfae avatar Mar 22 '19 14:03 sadsfae

After a lot of consideration and discussion since this RFE was opened we do not want to bring in an Ansible dependency into the codebase. The network automation we use is very simplistic, repeatable, modular and clean and dragging along Ansible library dependencies cannot be warranted for the myopic focus it would serve here. QUADS is a pure Python project and we try to stick to standard libraries and a minimal set of additional Python3 libraries only when needed.

We would not be utilizing it anywhere else, nor do we at this time see any great benefit from changing the architecture and design. That doesn't mean this door is closed but it's not something we want to consider at this time cc: @grafuls

sadsfae avatar Jun 26 '24 11:06 sadsfae