ansible-role-server/tasks/cronmails.yml

25 lines
739 B
YAML

---
# Server/Cronmails: Setup Mails from Cronjobs (install exim)
# Install and configure exim
- name: cronmails - Install exim4
include_tasks: "{{ item }}"
with_first_found:
- "cronmails-{{ ansible_distribution }}.{{ ansible_distribution_release }}.yml"
- "cronmails-{{ ansible_distribution }}.yml"
- "cronmails-{{ (override_os_family is defined) | ternary(override_os_family,ansible_os_family) }}.yml"
# Set cronjob env variables/ settings
- name: cronmails - Crontab set path
become: yes
cron:
name: PATH
env: yes
value: /bin:/sbin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin
- name: cronmails - Crontab set mailto
become: yes
cron:
name: MAILTO
env: yes
value: "{{ cron_email }}"