reverse engineering things that predecessors left without any documentation and throwing them out the window because devops

SaltStack has a pretty cool feature where you can manage your systems’ crontabs from a central location. You can keep them in state SLS files and look them up via salt cron exectuion module. With a little bit of extra work, you can also keep the crons in pillars and feed them to your systems (that’s something that I will certainly have to experiment with that later on).  Even with base functionality, this is a pretty cool thing that should help you with truly automating your environment to the point where you will rarely have to log into a server to perform management duties.

Let’s set up a basic crontab in Salt and distribute it to one of our minions just to get a basic idea how this all works.

Create a directory for your cron and an empty cron SLS file:

Add the following to your testcronjob.sls file:

This will execute “bash /opt/scripts/” command every 2 minutes. You can also specify standard UNIX timing values via:

By default, if you don’t specify a timing value, Salt will implement * for each value in the schedule.

You can implement the cron via:

And you can view it by:

You can find more information about managing crontabs in Salt below::