Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.




create the vagrant box

https://app.vagrantup.com/saltstack/boxes/cured-ubuntu1804

1- create a directory

2- change directory

vagrant init saltstack/cured-ubuntu1804
vagrant up


Code Block
titleinstall salt
sudo apt update -y
sudo apt install salt-master
salt --version



modify the files:





1- /etc/salt/master


Code Block
titlemaster file
vagrant@cured-ubuntu1804:~$ more /etc/salt/master | grep "#" -v | grep -v "^[[:space:]]*$"
file_roots:
  base:
    - /srv/salt


2- /etc/salt/minion


Code Block
titleminion file
vagrant@cured-ubuntu1804:~$ more /etc/salt/minion | grep "#" -v | grep -v "^[[:space:]]*$"
master: 127.0.0.1
id: minion1


PROXYjunos proxy configuration and pillars files
install junos-eznc 


sudo pip3 install junos-eznc

3- /etc/salt/proxy


Code Block
titleproxy file
vagrant@cured-ubuntu1804:~$ more /etc/salt/proxy | grep "#" -v | grep -v "^[[:space:]]*$"
master: 127.0.0.1


Pillars files:


/srv/pillar/mx.sls


Code Block
titlemx.sls
vagrant@cured-ubuntu1804:r$ more /srv/pilla/srx300-1-rl102.sls
proxy:
  proxytype: junos
  host: 172.30.95.174
  username: Netbox
  password: Netbox
  port: 830

name: SRX300-1-RL102
vagrant@cured-ubuntu1804:$ more /srv/pilla/qfx5100-1-rl102.sls
proxy:
  proxytype: junos
  host: 172.30.95.177
  username: Netbox
  password: Netbox
  port: 830

name: QFX5100-1-RL102




/srv/pillar/top.sls


Code Block
titletop.sls
vagrant@cured-ubuntu1804:$ more /srv/pilla/top.sls
base:
  'fw1_proxy':
    - srx300-1-rl102
  'fw2_proxy':
    - qfx5100-1-rl102


start the proxy

 #use -l debug option for debugging


sudo salt-proxy --proxyid=fw1_proxy -d                         

sudo salt-proxy --proxyid=fw2_proxy -d

Accept the salt-key on the master

sudo salt-key -a fw1_proxy

sudo salt-key -a fw2_proxy

Basic test

sudo salt 'fw1_proxy' test.ping

sudo salt 'fw1_proxy' junos.facts

sudo salt 'fw1_proxy' grains.items

collect and save it a .xml filesudo salt "fw2*" junos.cli "show chassis hardware detail " format=xml dest=/tmp/salt/sh