Apply a Salt Formula

Apply a Salt FormulaΒΆ

This section covers how you can test and apply a Salt Formula.

To apply all configured states (highstate) from a Salt Formula to all Minions, run on the Salt Master:

salt '*' state.apply


This command is equal to:

salt '*' state.highstate

To apply individual SLS files in a Salt Formula, run:

salt '*' state.apply <SLS_FILE_1>,<SLS_FILE_2>


Applying Salt Formulas on more than 100 nodes may result in numerous failures.


SaltStack runs new states in parallel leading to temporary out of service that may affect end users. To avoid taking down services on all the nodes at the same time, you can stagger highstates in a batch mode.

To apply a Salt Formula on a big number of nodes, for example, more than 100 nodes, follow one of the approaches below.

  • Use the --batch-size or -b flags to specify the number of nodes to have Salt apply a state in parallel:

    salt --batch-size <NUMBER_OF_NODES> '*' state.apply
  • Specify a percentage of nodes to apply a highstate on:

    salt -b <PERCENTAGE> '*' state.apply
  • Use node name conventions in the form of <GROUP>.<NODE_TYPE_NAME><NUM> to run a highstate by a pattern. For example: group1.cmp001:

    salt 'group1.cmp*' state.highstate
  • Use Node Groups that you can define in the Salt Master configuration file /etc/salt/master. To run a highstate on nodes within a Node Group, run:

    salt -N <GROUP_NODE> state.apply
  • Use Grains for grouping nodes specifying a grain variable in the /etc/salt/grains configuration file and then specify the grain value in the Salt command to apply a highstate for the nodes that have this grain value assigned:

    salt -G <GRAIN_NAME>:<GRAIN_VALUE> state.apply


You can use --batch-size flag together with Node Groups and Grains. For example:

salt --batch-size 10% -N computes1 state.apply
salt -b 5 -N compute:compute1 state.apply