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
4,842 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, 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
15,532 views
0 votes
1 answer

Is it possible to start ec2 Windows machine and run windows command using ansible playbook?

Hi@Lakshminarayanan, Yes, you can do that. But after ...READ MORE

answered Aug 14, 2020 in Ansible by MD
• 95,460 points
2,556 views
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 14, 2018 in Ansible by DareDev
• 6,890 points
2,413 views
+15 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 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
3,926 views
+2 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
14,516 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 10, 2019 in Ansible by Vijay
1,381 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP