Is it possible to run a playbook with a crontab?

0 votes
I've recently started learning Ansible and was wondering if executing playbooks using crontab is possible? (Like schedule the execution of the playbooks).
Jan 17, 2019 in Ansible by Ciara

1 answer to this question.

0 votes

Ofcourse you can run ansible playbook with crontab. Execute your ansible file in this way:

*/15 * * * *    if ! out=`ansible-playbook yourplaybook.yaml`; then echo $out; fi

Make sure of these and these should work like a charm

  • job user has access to ssh private keys
  • job environment is correct 
  • there is no package mixture on the host
answered Jan 17, 2019 by Yesha

Related Questions In Ansible

0 votes
1 answer

Is it possible to run an Ansible Playbook in python script?

Hey @Cerci, Of course its possible. You ...READ MORE

answered Jan 17, 2019 in Ansible by Nicolas
0 votes
1 answer
+1 vote
2 answers

Running ansible command on a single server when it is deployed to multiple servers

You can try the run_once attribute: Example from ...READ MORE

answered Jun 13, 2018 in Ansible by DareDev
• 6,850 points
0 votes
1 answer

Password prompt everytime I run a playbook is annoying

So Ansible provides a feature called vault ...READ MORE

answered Mar 6, 2019 in Ansible by William
+13 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 26, 2018 in DevOps & Agile by DragonLord999
• 8,420 points
0 votes
1 answer
+1 vote
1 answer

Is it possible to append a large amount of text to a file using Ansible?

Here is concept which you can follow. blockinfile is ...READ MORE

answered Jul 30, 2018 in Ansible by Atul
• 10,240 points
0 votes
1 answer

Is it possible to run commands on ansible host?

If you just trying to run a ...READ MORE

answered Jan 9, 2019 in Ansible by Vijay