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 in Ansible by Ciara
350 views

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 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 in Ansible by Nicolas
1,849 views
0 votes
1 answer
0 votes
1 answer

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,810 points
169 views
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 in Ansible by William
51 views
+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,380 points
145 views
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
2,448 views
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 in Ansible by Vijay
85 views