How to add MAILTO to a cron.d cron_file in Ansible?


I’m using Ansible to create a cron.d file using the cron_file parameter.

But how can I add a MAILTO to the file?

It seems the env=true is only for crontab, not cron.d files. Am I wrong?


Since Ansible 2.0 you have the cronvar command:

See the official documentation at

Leave a Reply