Book Image

Learning SaltStack

By : Colton Myers
Book Image

Learning SaltStack

By: Colton Myers

Overview of this book

Table of Contents (15 chapters)

The pieces of a state declaration


Just as with our remote execution commands, state declarations can be broken up into multiple pieces. Here is our state from before:

install_apache:
  pkg.installed:
    - name: apache2

Here is information about how the pieces line up and what each piece of the state declaration is called:

<ID Declaration>:
  <State Module>.<Function>:
    - name: <name>
    - <Function Arg>
    - <Function Arg>
    - <Function Arg>
    - <Requisite Declaration>:
      - <Requisite Reference>

The above reference, and more advanced examples, can be found in the Salt documentation at http://docs.saltstack.com/en/latest/ref/states/highstate.html#large-example.

We haven't talked about requisites yet, so ignore that section for the moment.

We start with the ID of our state. This is a string that must be unique across all of the states we are running at a given time. Note that it doesn't have to follow stringent requirements like...