I've read as much introduction documentation as I can find. Here are some outstanding questions that I'm still seeking answers for. Links or answers in comments are welcome.
-
Is it possible to define salt configurations for different server roles (e.g. webserver, database, loadbalancer, etc) which could be distributed to an arbitrary number of servers? (e.g. one server that is a {webserver,database,loadbalancer} or three servers where each is one of the kid.) I have a feeling this has something to do with Grains, but not sure how.
Answered: Use grains or nodegroups.
-
Can a directory be referenced from
salt://foo/bar
iffoo/
does not have aninit.sls
? Are there downsides from keeping sls configuration separate from statis assets that get deployed?Answered: Yes. No downsides, just organization.
-
Is there any guarantee on the order that sls definitions get executed? Or is there a way to specify dependencies? (For example, I need to make sure that libjpeg-related libs are symlinked to unusual places on Ubuntu before I can install the Python Imaging Library.)
- I feel like this could be done by specifying a target which is the expected symlink target (although there's like 4 of them), but that's a long messy string (example: sym.sls) — Is there another way?
-
I keep seeing
absent.sls
in various directories, what does that do? (Can't find a mention in the docs.) -
Pillars: Is there a way to specify default pillar valus, and then be able to "pass in" overrides?
- It took me a while to figure out that
foo.sls
andfoo/init.sls
is equivalent. It would be better if the documentation started by explaining design paradigms like this. (Coming from Python, it would have been more obvious if it wasfoo/__init__.sls
and much easier to spot in a directory full of*.sls
and other files.) - The terminology is not obvious. What's a State? What's a Pillar? Is there such a thing as a Stack? Are there other kinds of states other than a "high state"? (The minion/master stuff is pretty well-defined, though. And I kind-of have a grasp of Grains)
top.sls
is a strange choice of magic word. I would have expectedroot.sls
or maybe just a root-levelinit.sls
.
yes, use grains or nodegroups: https://salt.readthedocs.org/en/latest/ref/states/all/salt.states.grains.html?highlight=grains https://salt.readthedocs.org/en/latest/topics/targeting/nodegroups.html?highlight=nodegroup
I doubt salt will care where the file is in the file structure, as long as it's accessible to salt and in the states folder. The downside being organization, I generally try to keep relevant files with their states.
This would involve overstate. The concept of the Over State is managed on the master, a series of state executions is controlled from the master and executed in order. If an execution requires that another execution first run without problems then the state executions will stop.
https://salt.readthedocs.org/en/latest/ref/states/overstate.html?highlight=execution%20order
You can always use the -unless or -onlyif statement in your SLS to make sure a file/directory/thing exists before executing a command as well, but depending on the order it's executed (in a normal highstate) you may have to run highstate twice.
Feedback:
N/A
Stuff is mostly in the docs, takes some getting used to https://salt.readthedocs.org/en/latest/ is the best resource
You can set this to something else in the master config: