NAPALM modules for Salt, to facilitate vendor-agnostic event-driven network automation and orchestration
Modules for Salt, to retrieve, control, enforce and update configuration of network devices
New to Salt? Check out this document for a brief introduction to get up to speed on the basics.
Throughout the rest of this document, we’ll set up a test environment to run some salt commands against routers. This test environment uses a vagrant VM running Ubuntu 16.04, which acts as a salt-master as well as a proxy-master, which establishes and maintains connections to the routers in order to execute commands on them.
The simplest way to install Salt is via salt bootstrap. Here’s an example of an installation:
wget -O bootstrap-salt.sh https://bootstrap.saltstack.com/develop sudo sh bootstrap-salt.sh
This will install the salt-minion and salt-proxy only, but we also want this box to be the salt-master, so we’ll install that:
sudo sh bootstrap-salt.sh -M
For more specific installation instructions, see the platform-specific instructions from the official Saltstack documentation. Be aware to install the master distribution from the PPA repo, as on the local server will run as Master, controlling the devices as Proxy minions.
CentOS documentation can be found here.
If NAPALM has never been installed on your system it will need to be before napalm-salt can work:
sudo apt-get install libffi-dev libssl-dev python-dev python-cffi libxslt1-dev python-pip sudo pip install --upgrade cffi sudo pip install napalm-junos napalm-iosxr napalm-ios
The easy way: Salt users can install NAPALM through a single command, using the napalm-install Saltstack formula. A more detailed usage example can be found at: https://mirceaulinic.net/2017-07-06-napalm-install-formula/.
Configure Salt Proxy (and Minion)
The main configuration file needed to make Salt run as proxy-master is located at /etc/salt/proxy. This file should already exist, though you may need to create it.
We need to tell the proxy process that the local machine is the salt-master, and to turn off multiprocessing. You can add the following to the top of your /etc/salt/proxy file:
master: localhost multiprocessing: false mine_enabled: true # not required, but nice to have pki_dir: /etc/salt/pki/proxy # not required - this separates the proxy keys into a different directory
Additionally, you may want to edit the /etc/salt/minion file to point the master location to itself. This is not necessary, but it allows you to target the VM as a minion, i
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.