Friday, July 11, 2014

Scheduling a state.highstate on all minions with SaltStack schedulers

It was not obvious to me in the docs exactly where to put scheduling “stuff”. I was just looking at the scheduling docs page, so I’m sure some other doc mentioned this. Here’s how to get you started in case you don’t want to read more ;)


nano /srv/pillar/top.sls


base:


‘*’:

– schedule


mkdir /srv/pillar/schedule

nano /srv/pillar/schedule/init.sls


schedule:

highstate:

function: state.highstate

minutes: 60

maxrunning: 1


All that stuff will then result in all your minions running a highstate every 60 minutes. You can obviously filter by changing the ‘*’ to whatever partial minion name you want, just like with salt states.


You can see these schedules in each minion’s pillar data:

salt ‘lbtest*’ pillar.data. For me, it showed up at the bottom of the returned data.


I figure this could or should replace cron jobs, say, for database backups, though I’m not sure if there are any *serious* dangers of the salt minion dying or otherwise failing.





No comments:

Post a Comment