9

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

Josh Correia
  • 3,807
  • 3
  • 33
  • 50
aedry
  • 336
  • 4
  • 14

1 Answers1

14

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.

Gijs Brandsma
  • 933
  • 7
  • 13
  • Thanks for the clarification – aedry Mar 15 '19 at 16:24
  • As `state.sls` takes at [least one argument](https://docs.saltproject.io/en/latest/ref/modules/all/salt.modules.state.html#salt.modules.state.sls) is safer to use it. – EsmaeelE Dec 19 '21 at 11:54