diff --git a/changelog/31468.added b/changelog/31468.added new file mode 100644 index 00000000000..f1b2b802ba9 --- /dev/null +++ b/changelog/31468.added @@ -0,0 +1 @@ +Allow users to enable 'queue=True' for all state runs via config file diff --git a/conf/minion b/conf/minion index b6119aac9d8..e4845cb8d27 100644 --- a/conf/minion +++ b/conf/minion @@ -591,6 +591,16 @@ # #state_aggregate: False +# Instead of failing immediately when another state run is in progress, a value +# of True will queue the new state run to begin running once the other has +# finished. This option starts a new thread for each queued state run, so use +# this option sparingly. Additionally, it can be set to an integer representing +# the maximum queue size which can be attained before the state runs will fail +# to be queued. This can prevent runaway conditions where new threads are +# started until system performance is hampered. +# +#state_queue: False + # Disable requisites during state runs by specifying a single requisite # or a list of requisites to disable. # diff --git a/doc/ref/configuration/minion.rst b/doc/ref/configuration/minion.rst index bf2fe0e6958..5d96171b309 100644 --- a/doc/ref/configuration/minion.rst +++ b/doc/ref/configuration/minion.rst @@ -2274,6 +2274,31 @@ aggregate just those types. state_aggregate: - pkg +.. conf_minion:: state_queue + +``state_queue`` +--------------- + +Default: ``False`` + +Instead of failing immediately when another state run is in progress, a value +of ``True`` will queue the new state run to begin running once the other has +finished. This option starts a new thread for each queued state run, so use +this option sparingly. + +.. code-block:: yaml + + state_queue: True + +Additionally, it can be set to an integer representing the maximum queue size +which can be attained before the state runs will fail to be queued. This can +prevent runaway conditions where new threads are started until system +performance is hampered. + +.. code-block:: yaml + + state_queue: 2 + .. conf_minion:: state_verbose ``state_verbose`` diff --git a/salt/config/__init__.py b/salt/config/__init__.py index 372555969d2..26b3778203e 100644 --- a/salt/config/__init__.py +++ b/salt/config/__init__.py @@ -366,6 +366,8 @@ VALID_OPTS = immutabletypes.freeze( # to the jid. WARNING: A change to the jid format may break external # applications that depend on the original format. "unique_jid": bool, + # Governs whether state runs will queue or fail to run when a state is already running + "state_queue": bool, # Tells the highstate outputter to show successful states. False will omit successes. "state_verbose": bool, # Specify the format for state outputs. See highstate outputter for additional details. @@ -1181,6 +1183,7 @@ DEFAULT_MINION_OPTS = immutabletypes.freeze( "state_auto_order": True, "state_events": False, "state_aggregate": False, + "state_queue": False, "snapper_states": False, "snapper_states_config": "root", "acceptance_wait_time": 10,