Skip to content

SaltStack formulas presetup/install/testing/usage

Look through docs briefly

Official Doc (not so great, but useful)


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

  - git
  - roots
These list going to be searched through in listed order.

More at: section on fileserver backends.

Enable formula remote repos

Reference information:

  1. You add that as remote repository of formulas. official doc

  2. 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.

Formulas usage

To use formulas:

in sls file

  - 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
Here docker-formula source included in docker.sls, and add your commands, formulas and so on. That is called overload.


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