Skip to content

Instantly share code, notes, and snippets.

@renoirb
Last active January 18, 2016 10:45
Show Gist options
  • Save renoirb/7160412 to your computer and use it in GitHub Desktop.
Save renoirb/7160412 to your computer and use it in GitHub Desktop.
Salt stack master to use remote git for both pillar and state files
##
## Use-case: Host in a remote git (on a ssh-able host) both pillars and states on Salt Stack 0.17.x
##
## See thread: https://groups.google.com/forum/#!topic/salt-users/bOz2cdY-pnY
#
# Salt stack master and minion procedure, short version:
#
# - On the Master:
#
# wget -O - http://bootstrap.saltstack.org | sudo sh -s -- -M git v0.17.0
# sudo sh -c 'echo "master: INTERNAL_IP_GOES_HERE" >> /etc/salt/minion.d/master.conf'
# sudo service salt-minion restart
# sudo service salt-master restart
#
# - On the Minions:
#
# wget -O - http://bootstrap.saltstack.org | sudo sh -s -- git v0.17.0
# sudo sh -c 'echo "master: INTERNAL_IP_GOES_HERE" >> /etc/salt/minion.d/master.conf'
#
# - On the Master, continue with:
#
# sudo salt '*' pkg.install python-pip,python-virtualenv
# sudo salt '*' pkg.latest_version python-git
#
# - Copy contents of this file in a salt-master node in `master.d/` folder
# with a file name ending by `.conf`, e.g.: `/etc/salt/master.d/sample.conf`
#
# - Restart the services
#
# salt '*' service.restart salt-minion
# salt-call service.restart salt-master
#
##########################################################################
# Config proposal
##########################################################################
# Assumed, by reading: https://github.com/saltstack/salt/blob/develop/salt/fileserver/gitfs.py
# but contradicting https://salt.readthedocs.org/en/latest/ref/configuration/master.html#master-file-server-settings
fileserver_backend:
- git # <- Didn't we had 'gitfs' here before?
- roots
gitfs_remotes:
- ssh://user@remote:~/git/salt
# See comment head in: https://github.com/saltstack/salt/blob/develop/salt/pillar/git_pillar.py
ext_pillar:
- git: work-refactor-201310 ssh://user@remote:~/git/pillar
##########################################################################
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment