SaltStack formulas presetup/install/testing/usage¶
Look through docs briefly¶
Prepare Salt formulas¶
Fork what you want from salt formulas.
Why? Because official documentation points to it, but also unconditionally requires.
Create a branch in formulas¶
Correspond to your environment ('base' in my setup):
git clone formula git cd formula git checkout -b 'base' git push origin 'base'
Install Git Backend in Python¶
Need to use deprecated Dulwich on Arch. preferred pygit2 is installed, but was not working on Arch.
Officail notes: installing-dependencies.
In Arch Linux:
yaourt -Syu python2-dulwich
Or use PIP install:
pip install pygit2
pip install gitpython
pip install dulwich
Enable Salt to use GIT backend¶
/etc/salt/master --- fileserver_backend: - git - roots
More at: section on fileserver backends.
Enable formula remote repos¶
/etc/salt/master --- gitfs_remotes: - https://github.com/saltstack-formulas/docker-formula.git
You add that as remote repository of formulas. official doc
This is basically works as literal remote fs. official doc
Official documentation has an error¶
Be sure to put '.git' at the end of GIT URLs. Salt requires them to parse links with python backends.
To use formulas:¶
in sls file
*.sls --- - docker
*.sls --- docker:
to install formula using docker-formula.
Look at GitHub documentation of formulas to see how to do install with it and other actions. Name of formula does not required to correspond to install command. Like here.
To overload formula:¶
You can extend formulas or use their source. To include formula source in sls (you can overload, like docker.sls)
docker.sls --- include: - docker
Check if SaltStack formula works¶
sudo salt 'host' state.show_sls docker
To debug Master¶
sudo salt-master -l debug
If you get: [CRITICAL] No suitable gitfs provider module is installed.¶
SaltStack can not find python git backend (pygit2, GitPython or Dulwich). So you need to figure-out this.
Look at Docker state module¶