This is a complete set of saltstack formulas that I developed for personal usage. Some of them are available as independent ones either as personal repos or official saltstack-formulas.
All of them share a rationale that I'll document explicitly (TBD).
The subdirectories *-saltstack-formula could be stacked in your file_roots to give you ready-to-use states to manage your systems.
General customization strategies
Use pillar data. This is the absolutely recommended way to use the formulas. In most occassions all you need is to fill some of the key-values shown in the
pillar.examplefile. If you feel that a certain value should be there then don't hesitate to propose an enhancement.
extra_confkey that in some cases is present in the pillar to add arbitrary configuration lines in the templates provided. This is a way to have a better customization without over-populating the pillar with new key-values.
Add new subdirectories under
filesin addition to
default. This new subdirectories will contain different files to be used in certain conditions. This selection mechanism is based by default in the
ìdgrain of the minion (i.e. if there's a new subdirectory named
minion01then the formula is going to look there first for that minion). This selection behavior can be extended to make it depend on any sorted list of grains, defined by the key
For example, let's define in pillar something like:
.. code:: yaml
formula-name: files_switch: ['id', 'os_family']
Let's have this
.. code:: asciidoc
files |-- minion01 | `-- etc | `-- foo.conf.jinja |-- Debian | `-- etc | `-- foo.conf.jinja `-- default |-- etc | |-- foo.conf.jinja | `-- bar.conf.jinja `-- usr/share/thingy/*
With this, we have the following:
if the minion id is
files/minion01/etc/foo.conf.jinjais going to be used
else if the minion os_family is
files/Debian/etc/foo.conf.jinjais going to be used
files/default/etc/foo.conf.jinjais going to be used
Beware: this is not designed to substitute pillar data. Remember that pillar has to be used for information that it's essential to be only known for a certain set of minions (i.e. passwords, private keys and such).
As a last resort you can actually fork the formula to suit your needs, keeping an eye for further improvements to merge into yours. Of course any pull- request that you can bring back it would be taken in account ;-)
Add remotes for the repo-per-formula and add them as subtrees:
FORMULAS="apache mysql nginx php5 shorewall sudo system users varnish zabbix" for i in $FORMULAS do git remote add -f $i-saltstack-formula \ firstname.lastname@example.org:moreda/$i-saltstack-formula.git git subtree add -P $i-saltstack-formula $i-saltstack-formula master done
Pull all the repo-per-formula subtrees:
FORMULAS="apache mysql nginx php5 shorewall sudo system users varnish zabbix" for i in $FORMULAS do git subtree pull -P $i-saltstack-formula $i-saltstack-formula master done