ansible as infrastructure-wide cron

June 11, 2013

A discussion last week made me think of the following:
Ansible as a mechanism to provide network/infrastructure-wide cron.

A couple of systems that do major administrative tasks could have a infra-cron file like:

01 04 * * * root run_system_wide_task
0 01 * * Sun root trigger_client_backups

Now, I’m sure lots of you are saying ‘yes, that’s cron, you don’t need another one’ but with ansible you could have an orchestrated cron. A cron that properly says ‘wait for the previous task to finish before you launch this other one’ or a cron that is able to better contingency handling if some of your systems are offline or disconnected.

I don’t have any code for this but I wanted to toss it out as a potentially odd idea that maybe someone would love.

10 Responses to “ansible as infrastructure-wide cron”

  1. xaeth Says:

    So I’d been looking at Chronos lately cause we have the need for a web based cron management system. Chronos has some fun java dependencies and thus is not readily packaged with RPM at the moment (they are working on it).

    I’m not gonna lie, I’d rather see a python version written with ansible on the backend 🙂

  2. oxtan Says:

    we’ve been doing this with cfengine for a decade 😉

    • skvidal Says:

      that’s nice. The advantage of ansible is not needing to pre-install anything on your servers before your use it.

      • oxtan Says:

        cfengine is just the last bit of our install procedure (kickstart/jumpstart/FAI), so this has never been a problem.

      • oxtan Says:

        Forgot to say: welcome to the club of configuration management, whatever you use it will be much better than no management 🙂

  3. Tobias Florek Says:

    any idea on how a config file might look like?

    i do something similar with make files and ssh called by cron. but i guess i could easily replace ssh with ansible.

    • skvidal Says:

      I’m not sure what it might need. On the surface level I think adding one field to the existing cron format would be easiest to cope with for lots of people.

      Adding conditionals is where it will get more complicated.

      • Tobias Florek Says:

        hmm. what should the additional field specify? we have not identified every task, so it cannot be a simple dependency field (“after: that_task”).

        i have the strong feeling crontab(5) might not be expressive enough for that. i mean: for most tasks with more than one pipe people use a script they call from cron and not the direct command. you can certainly specify the dependencies in the script then (see djb’s do for an example).

        • skvidal Says:

          A fair question. Like I said it’s just an idea. I’m not sure of all the details.

          • Tobias Florek Says:

            don’t understand me wrong. i am all for lightweight sysadmin things. and it sounds great in principle. i’m just not sure how it can work and if cron is the right tool to extend.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: