Skip to content

Instantly share code, notes, and snippets.

@boileaum
Last active April 19, 2018 12:53
Show Gist options
  • Save boileaum/ef6136bbc274921c2dd905ac48d13729 to your computer and use it in GitHub Desktop.
Save boileaum/ef6136bbc274921c2dd905ac48d13729 to your computer and use it in GitHub Desktop.
A bash script to install a Salt minion
#!/bin/bash
if [ "$EUID" -ne 0 ]
then
echo "Please run as root"
exit
fi
# From Saltstack documentation https://docs.saltstack.com/en/latest/topics/tutorials/quickstart.html
cd /tmp
curl -L https://bootstrap.saltstack.com -o bootstrap_salt.sh
sh bootstrap_salt.sh
service salt-minion stop
# Add these lines to initiate salt configuration
# (returned by this command:
# grep -v '^$' /etc/salt/minion.d/f_defaults.conf |grep -v '^ *#'
# )
read -r -d '' ADD_TO_MINION << EOM
master: "salt"
file_roots:
base:
- /srv/salt
- /srv/formulas/salt-formula
pillar_roots:
base:
- /srv/pillar
EOM
echo "$ADD_TO_MINION" > /etc/salt/minion
hostname -s > /etc/salt/minion_id
service salt-minion start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment