Skip to content

Instantly share code, notes, and snippets.

@mortn
Last active July 18, 2018 10:18
Show Gist options
  • Save mortn/163d1d83cf9fae97de1ab7b264a853bc to your computer and use it in GitHub Desktop.
Save mortn/163d1d83cf9fae97de1ab7b264a853bc to your computer and use it in GitHub Desktop.
Saltstack formula setup and updating
#!/bin/bash
formulas="django dnsmasq docker haproxy keepalived letsencrypt libvirt nfs nftables nginx ntp php postfix powerdns salt systemd users varnish vim"
formula_root=/srv/formula
states_root=/srv/salt
pillars_root=/srv/pillar
git_url=git@github.com:saltstack-formulas
http_url=https://github.com/saltstack-formulas
[ ! -d $formula_root ] && mkdir $formula_root
cd $formula_root
for formula in $formulas;do
ff=$formula-formula
if [ ! -d $formula_root/$ff ]; then
cd $formula_root
git clone ${git_url}/$ff.git
else
cd $formula_root/$ff
echo -n "Pulling $ff into $PWD "
git pull
fi
rsync -a $formula_root/$ff/$formula/ $states_root/$formula/
[ ! -d $pillars_root/$formula ] && mkdir $pillars_root/$formula
rsync -a $formula_root/$ff/pillar.example $pillars_root/$formula/
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment