Is it possible to execute an ansible playbook from crontab? We have a playbook that needs to run at a certain time ever day, but I know that cron doesn't like ssh.
Tower has a built in scheduling engine, but we are not interested in using Tower. How are other people scheduling ansible playbooks?
We can run as konstantin-suvorov's answer as well as
type
# whereis ansible-playbook
/usr/bin/ansible-playbook
and run with the path displayed in the output
we can run with this in crontab
#crontab -e
*/15 * * * * /usr/bin/ansible-playbook /home/user1/yourplaybook.yml
It worked like charm
It will also work, I am using this to check an agent status and starting it if it is stopped.
*/5 * * * * ansible-playbook -i /root/playbooks/agent /root/playbooks/agent.yml
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With