We have a collection of load balanced web servers, and we have cron jobs 
spread across the server base. 

I would like to manage these cron jobs in Ansible.  

The current state is to have all the cron jobs on all the servers, 
disabled, and then to selectively enable the ones that need to run on each 
server. 

On my test server, I rolled out all the cron jobs as state=present 
disabled=true and got all the cron jobs, properly commented out. 

I can do a play as follows:


    - name: cron Update Webmin
      cron:
        user: root
        state: present
        name: "Update Webmin"
        minute: "10"
        hour: "10"
        day: "*"
        month: "*"
        weekday: "2"
        job: "/etc/webmin/package-updates/update.pl"
      when: ansible_hostname == 'web-node-1'

But when I go into the playbook and change web-host-1 to web-host-2, that 
won't remove the job from web1. 

So my current thought is: 
    - name: cron Update Webmin
      cron:
        user: root
        state: present
        disabled: true  
        name: "Update Webmin"
        minute: "10"
        hour: "10"
        day: "*"
        month: "*"
        weekday: "2"
        job: "/etc/webmin/package-updates/update.pl"

    - name: cron Update Webmin
      cron:
        user: root
        state: present
        name: "Update Webmin"
        minute: "10"
        hour: "10"
        day: "*"
        month: "*"
        weekday: "2"
        job: "/etc/webmin/package-updates/update.pl"
      when: ansible_hostname == 'web-node-1'

This should roll all the jobs to all the servers, then enable them only 
where needed.

So, for a reality check, does this seem the best method? 

Thanks, 

Ed G


-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/6e8f8017-e4f2-43ce-97b7-e6b684f01089%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to