The highstate
Until now, we have only been running a single state file at a time using state.sls
. However, this doesn't scale very well once we have many state files to manage our entire infrastructure. We want to be able to split different pieces of our state into different files to make them more modular. How can we accomplish this?
In the previous chapter, you learned how to target your pillar files to different minions using a top.sls
file or topfile. Topfiles can also be used in the state system to target different state files to different minions.
Let's create our topfile now, which is in /srv/salt/top.sls
, as follows:
base: '*minion': - apache 'os_family:debian': - match: grain - users_and_ssh
Note that this file is structured almost exactly like the topfile that we used for our pillar data. At the top level (first line), we define our environment. There will be more on environments later—for now, it's enough to note that the...