I would like to schedule a highstate
to run every night but not in parallel. Is there a way to add batch
option to the scheduling system?
Example:
schedule:
highstate:
enabled: True
function: state.highstate
maxrunning: 1
when: 3:00am
kwargs:
batch: 1
Ideally I would like to also randomize the time when it runs. I guess I could schedule to run every two hours within one hour time range so it will run only once:
schedule:
highstate:
enabled: True
function: state.highstate
maxrunning: 1
range:
start: 3:00am
end: 4:00am
hours: 2
kwargs:
batch: 1
When initiating a highstate from the master you can utilize a feature known as batch mode.
The
--batch-size
flag allows you to specify how many minions to run against in parallel. You can use the command below:Regarding the time when it runs, you can use
splay
argument like the following:This will splay the time between 10 and 15 seconds
If you want to use it with a scheduling system:
Edit
/etc/anacrontab
and addRANDOM DELAY
andSTART_HOURS_RANGE
parameters:1 10 update.daily /usr/bin/salt --batch-size 1 '*' state.highstate