how to make cron module for running ansible playbooks

1,681 views
Skip to first unread message

acharya tejaswi indurthi

unread,
May 1, 2017, 6:11:25 AM5/1/17
to Ansible Project
Hi,

I am trying to run cron module for running ansible playbook for every one minute.But it is not working.I can see the job but the job is not running.The playbook is wrote is 

---
- hosts: localhost
  connection: local
  gather_facts: no
  tasks:
  - cron:
      name: "yum autoupdate"
      minute: "*/1"
      job: "`ansible-playbook own_role.yml`"
      state: present


what is the problem here i was not able to understand.Can anyone help me

Thanks,

Dick Davies

unread,
May 1, 2017, 9:20:35 AM5/1/17
to ansible list
If you can see the job, then Ansible has done its bit. You need to look
at the job itself now.

On 1 May 2017 at 11:11, acharya tejaswi indurthi
> --
> 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 ansible-proje...@googlegroups.com.
> To post to this group, send email to ansible...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/226cd837-ad3d-49ae-b597-0ede214d6d6b%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

acharya tejaswi indurthi

unread,
May 2, 2017, 3:19:44 AM5/2/17
to Ansible Project, di...@hellooperator.net
I was able to see the job by typing "crontab -e".But it is not working.Is the job which i gave there is in the right way.

Paul Tötterman

unread,
May 2, 2017, 5:30:54 AM5/2/17
to Ansible Project, di...@hellooperator.net
I was able to see the job by typing "crontab -e".But it is not working.Is the job which i gave there is in the right way

Have you tried:

   crontab -l -u root

Try changing the user. Which remote_user are you using?

 Cheers,
Paul

acharya tejaswi indurthi

unread,
May 3, 2017, 4:45:07 AM5/3/17
to Ansible Project, di...@hellooperator.net
yes it is working when i gave the path "/usr/local/bin/ansible /etc/ansible/playbooks/own_role.yml" in cron module.There is an internal issue so it is not worked.but now it is working fine


Thanks,
Reply all
Reply to author
Forward
0 new messages