Applying Salt States
-
I'm wondering how everyone keeps their minion states applied.
Do you do a manual highstate on the master whenever you feel like it? Do you do it on a schedule via cron, like hourly?
Do you do it via a cron job on the minions?
Do you have the minions config file set to do it when salt-minion service starts?
At reboot?
How are you keeping your minions in their desired state according to your top.sls file, how often, why/why not?
-
@tim_g
I didn't reach this advanced topics in saltstack, but what I think I would do is create state that would chain other states perhaps, and schedule at a time where the minion is not being used like midnight
-
We cron and do it every 20 minutes. Doesn't affect wait times much compared to every 15 minutes, but is a 25% load reduction. So it is a nice place to be. I've seen enterprises do every 10.
-
@emad-r said in Applying Salt States:
@tim_g
I didn't reach this advanced topics in saltstack, but what I think I would do is create state that would chain other states perhaps, and schedule at a time where the minion is not being used like midnight
If you do it that infrequently, it loses the "fix it" ability that is a key value to state systems. The idea of doing it every few minutes is that the machine is verifying its own state constantly to look for something breaking, changing or whatever.
-
@scottalanmiller said in Applying Salt States:
We cron and do it every 20 minutes. Doesn't affect wait times much compared to every 15 minutes, but is a 25% load reduction. So it is a nice place to be. I've seen enterprises do every 10.
Do you corn a Highstate on the Master every 20 minutes, or are all the minions croned to do it then?
I was thinking about croning a Highstate on the Master every 15 minutes. And if I notice too much load I'll do your idea and up it to 20 and see how that feels.
-
I'm testing the following:
I created a
saltmaster
state. In there, is a section that includes the following:/etc/cron.d/salt-highstate: file.managed: - source: salt://saltmaster/files/salt-highstate - user: root - group: root - mode: 644
And the
salt-highstate
file:*/15 * * * * root /usr/bin/salt -b 25\% '*' state.apply
I'm using the
-b 25%
so that all minions don't get changes all at once. It doesn't matter if they do at this point, because I don't have a farm of webservers that will all restart the web service at the same time... I'm just practicing the concept. -
@tim_g said in Applying Salt States:
@scottalanmiller said in Applying Salt States:
We cron and do it every 20 minutes. Doesn't affect wait times much compared to every 15 minutes, but is a 25% load reduction. So it is a nice place to be. I've seen enterprises do every 10.
Do you corn a Highstate on the Master every 20 minutes, or are all the minions croned to do it then?
I was thinking about croning a Highstate on the Master every 15 minutes. And if I notice too much load I'll do your idea and up it to 20 and see how that feels.
We do it on the master.
-
I just noticed I had a typo in the
salt-highstate
part above. Fixed now. I left out the'*'
, which specifies all minions.Also, a
\
is needed before the%
symbol to escape it.