Dependencies using requisites

These states will run in the order they are defined in the file by default. However, we can also affect the ordering using requisites. Requisites allow us to create dependencies and interactions between our states.

The require requisite

The most basic requisite is require, which allows you to specify that one state requires another state to be run successfully first. Make sure you note both purposes—the require requisite both ensures correct ordering, and ensures that the requiring states runs only if the required state ran successfully.

In this case, we want to make sure that apache is installed before we try to run it. Thus, we will add a require requisite declaration under our service.running state, as shown here: ...

Get Learning SaltStack 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.