Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the difference between state.sls and state.apply?

What's the difference between state.apply and state.sls? When should I use state.apply vs state.sls?

like image 824
aedry Avatar asked Mar 15 '19 15:03

aedry


People also ask

What is state Saltstack?

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.

What is SLS file in salt?

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.

What is Saltstack Highstate?

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

How do I apply for Salt state?

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.


1 Answers

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.

like image 190
Gijs Brandsma Avatar answered Sep 23 '22 03:09

Gijs Brandsma