What's the difference between state.apply and state.sls? When should I use state.apply vs state.sls?
State. A reusable declaration that configures a specific part of a system. Each Salt state is defined using a state declaration. State Declaration. A top level section of a state file that lists the state function calls and arguments that make up a state.
The core of the Salt State system is the SLS, or SaLt State file. The SLS is a representation of the state in which a system should be in, and is set up to contain this data in a simple format. This is often called configuration management.
A “highstate” is a way for Salt to dynamically determine which Salt Formulas should be applied to a certain minion. To start with you execute a “highstate” like this: salt 'minion01' state.highstate. This command causes the Minion to download and examine a file from the Salt Master called the “top file”.
On your Salt master, run the following command to apply the Top file: salt '*' state. apply #calling state. apply with no arguments starts a highstate.
state.sls <state_file>
will execute the states in a specific file.
state.highstate
will execute the highstate configured by top.sls
state.apply
will do a state.highstate
if no arguments are given and a state.sls <state_file>
when a argument is given.
You can look at state.apply
as an easy way of using states command.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With