Versions Compared

Key

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

Book:

https://www.juniper.net/documentation/en_US/day-one-books/DO_Automating_SALT.pdf



https://docs.saltstack.com/en/master/topics/tutorials/walkthrough.html
Install


https://github.com/saltstack/salt-bootstrap

This one:
https://repo.saltstack.com/#bootstrap


Install python and pip and update sudo apt
Code Block
titleinstall package
collapsetrue
Python3 with Bootstrap installation
Pre-Check:
sudo apt update -y
python3 --version
#sudo apt-get install python3-pip
pippip3 install --Uversion
pip
pip3#pip3 install -U pip3

Master Usingand theMinion bootstrapInstallation:
curl -o bootstrap-salt.sh -L https://bootstrap.saltstack.com -o install_salt.sh
sudo sh bootstrap-install_salt.sh git master

pip3 install salt -P -M -x python3

Only Minion Installation:
curl -L https://
repo
bootstrap.saltstack.com
/
Code Block
titlewith python 2.7
sudo apt update -y
sudo apt-get upgrade -y

sudo apt install salt-master
sudo apt install salt-minion
pip install -U pip
pip -o install_salt.sh
sudo sh install_salt.sh -P -x python3

Post Check:
salt --version

Add-on for junos proxy:
sudo pip3 install junos-eznc
sudo pip3 install 972jxmlease

pythonConfiguration --version( see below)
973sudo  pip --version
  974  salt --version

vi /etc/salt/master
sudo vi /etc/salt/masterminion
sudo vi /etc/salt/minionproxy
#sudo salt-master -l debug  # for test or debugging purpuses
sudo salt-master -d
sudo salt-minion -d
sudo salt-proxy -d

Restart salt:
sudo service salt-master restart
sudo service salt-minion restart
sudo salt-key -L
sudo salt-key -A





alias for pip and python alias on linux and tag

sudo systemctl start salt-master


"/etc/salt/master" file on the Master

sudo vi /etc/salt/master

un "#" those three lines:


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



"/etc/sal/minion" file on the Minion


Code Block
titleminion file
labuser@saltsackmaster:~$ more /etc/salt/minion | grep "#" -v | grep -v "^[[:space:]]*$"
master: 172.30.95.91
id: minion1


start the Minion

salt-minion -l debug  [ debug mode ]    or     salt-minion -d  [ deamon mode ]


Start the Master

accept the key on the Master

salt-master -l debug  [ debug mode ]     or     salt-master -d  [ deamon mode ]

https://docs.saltstack.com/en/latest/ref/cli/salt-key.html#actions

sudo salt-key -a minion1

sudo salt-key -A  [ all keys ]


Test module

.

CMD Module

File Module

.

Grains Module

salt '*' test.ping [ test module and function ping from master to minion ]

salt '*' test.version  /  salt '*' test.versions_report

salt 'min*' cmd.run 'pwd'

salt 'min*' file.touch '/tmp/salt_files/new.txt'

salt 'min*' file.write '/tmp/salt_files/new.txt' 'write something here'

salt '*' grains.items



...