junos proxy configuration and pillars files

Documentation:    https://github.com/ksator/junos-automation-with-saltstack/wiki/09.-Junos-proxy-end-to-end-examples



check python installation
sudo apt-get install python3-pip
sudo pip3 install junos-eznc
sudo python3 -m easy_install --upgrade pyOpenSSL
sudo pip3 install jxmlease





configuration file

sudo vi /etc/salt/proxy

master: 172.30.95.91

List of all proxy:

/srv/pillar/top.sls  

all configs
root@saltsackmaster:/srv/pillar# more *.sls

::::::::::::::
top.sls
::::::::::::::
base:
  'srx300-1-rl102':
    - srx300-1-rl102
  'qfx5100-1-rl102':
    - qfx5100-1-rl102


::::::::::::::
qfx5100-1-rl102.sls
::::::::::::::
proxy:
  proxytype: junos
  host: 172.30.95.177
  username: Netbox
  password: Netbox
  port: 830

name: QFX5100-1-RL102



::::::::::::::
srx300-1-rl102.sls
::::::::::::::
proxy:
  proxytype: junos
  host: 172.30.95.174
  username: Netbox
  password: Netbox
  port: 830

name: SRX300-1-RL102




top.sls
labuser@saltsackmaster:~$ more /srv/pillar/top.sls
base:
  'fw1_proxy':
    - mx

list of all Devices

/srv/pillar/mx.sls

mx.sls
labuser@saltsackmaster:~$ more /srv/pillar/mx.sls
proxy:
  proxytype: junos
  host: 172.30.95.174
  username: Netbox
  password: Netbox
  port: 830

name: SRX300-1-RL102

start the salt proxy 

in debug mode to check that everything is ok:

sudo salt-proxy --proxyid=fw1_proxy -l debug

then in deamon mode



Accept the salt-key

sudo salt-key -L

sudo salt-key -a fw1_proxy

test sudo salt 'fw1_proxy' test.ping
get factssudo salt 'fw1_proxy' junos.facts
grainssudo salt 'fw1_proxy' grains.