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
93 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
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
585 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,520 points
76 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
15 views
+13 votes
2 answers
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,200 points
1,421 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
27 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.