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):
1 2 3 4
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¶
1 2 3 4 5
/etc/salt/master --- fileserver_backend: - git - roots
More at: section on fileserver backends.
Enable formula remote repos¶
1 2 3 4
/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
1 2 3
*.sls --- - docker
1 2 3
*.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)
1 2 3 4
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¶