This is my playbook. Pretty simple. The problem is with the "with_items". It iterates over all the items, but, it only writes the last item to the crontab file. I think it is overwriting it. Why is this happening?
- name: Create cron jobs to send emails
cron:
name="Send emails"
state=present
special_time=daily
job="/home/testuser/deployments/{{ item }}/artisan --env={{
item }} send:healthemail"
with_items:
- london
- toronto
- vancouver
The cron
module expects the job name to be unique. Change it to:
name="Send emails {{ item }}"
See: cron – Manage cron.d and crontab entries
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