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

Get Learning SaltStack - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.