Skip to content

Instantly share code, notes, and snippets.

@githubfoam
Last active May 22, 2018 12:33
Show Gist options
  • Save githubfoam/2241896bc711a47eec29ada36fc7d26b to your computer and use it in GitHub Desktop.
Save githubfoam/2241896bc711a47eec29ada36fc7d26b to your computer and use it in GitHub Desktop.
saltstack cheat sheet
SaltStack master operations
salt-key -L -> Showing all minions
salt-key -a <minion_id> -> Accepting an unaccepted minion
salt-key -A -> Accepting all unaccepted minions
salt-key -d <minion_id> -> Removing a minion
salt '*' state.sls nginx -> Running formula
salt '*' cmd.run 'ls -l /etc'
salt '*' pkg.install vim
salt '*' network.interfaces
salt '*' test.echo 'foo: bar'
salt-call -> masterless minion.
salt '*' state.apply vim -> Run /srv/salt/vim.sls
sudo salt-key -F master
#Install master/node
#master node
8 sudo apt-get update -y
9 sudo apt-get dist-upgrade -y
11 sudo apt-get install salt-master salt-ssh salt-cloud salt-doc -y
14 sudo vi /etc/salt/master
# The address of the interface to bind to:
interface: 192.168.39.11
26 sudo salt-key -a ubuntu
27 sudo salt-key -L
15 sudo service salt-master restart
16 sudo service salt-master status
32 sudo mkdir -p /srv/salt/
33 sudo mkdir -p /srv/salt/nginx
34 sudo vi /srv/salt/nginx/init.sls
nginx:
pkg:
- installed
35 sudo salt ubuntu state.sls nginx
36 sudo salt ubuntu test.ping
#slave node
apt-get update -y
apt-get dist-upgrade -y
apt-get install salt-minion -y
sudo vi /etc/salt/minion
# Set the location of the salt master server. If the master server cannot be
# resolved, then the minion will fail to start.
master: 192.168.39.11
sudo service salt-minion restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment