2019-10-06 20:55:56 +00:00
|
|
|
---
|
|
|
|
# Server/Cronmails: Setup Mails from Cronjobs (install exim)
|
|
|
|
|
|
|
|
# Install and configure exim
|
2023-04-28 21:25:21 +00:00
|
|
|
- name: Cronmails - Install exim4
|
2022-11-06 19:37:54 +00:00
|
|
|
when: not exim_skip_install
|
2021-08-28 14:50:37 +00:00
|
|
|
ansible.builtin.include_tasks: "{{ item }}"
|
2020-03-08 15:41:55 +00:00
|
|
|
with_first_found:
|
|
|
|
- "cronmails-{{ ansible_distribution }}.{{ ansible_distribution_release }}.yml"
|
|
|
|
- "cronmails-{{ ansible_distribution }}.yml"
|
2023-04-28 21:25:21 +00:00
|
|
|
- "cronmails-{{ (override_os_family is defined) | ternary(override_os_family, ansible_os_family) }}.yml"
|
2021-05-02 16:19:11 +00:00
|
|
|
ignore_errors: true
|
2019-10-06 20:55:56 +00:00
|
|
|
|
2020-03-27 21:56:57 +00:00
|
|
|
# Set cronjob env variables/ settings
|
2023-04-28 21:25:21 +00:00
|
|
|
- name: Cronmails - Crontab set path
|
|
|
|
become: true
|
2021-08-28 14:50:37 +00:00
|
|
|
ansible.builtin.cron:
|
2019-10-06 20:55:56 +00:00
|
|
|
name: PATH
|
2023-04-28 21:25:21 +00:00
|
|
|
env: true
|
2019-10-06 20:55:56 +00:00
|
|
|
value: /bin:/sbin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin
|
2023-04-28 21:25:21 +00:00
|
|
|
- name: Cronmails - Crontab set mailto
|
|
|
|
become: true
|
2021-08-28 14:50:37 +00:00
|
|
|
ansible.builtin.cron:
|
2019-10-06 20:55:56 +00:00
|
|
|
name: MAILTO
|
2023-04-28 21:25:21 +00:00
|
|
|
env: true
|
2019-11-12 20:06:04 +00:00
|
|
|
value: "{{ cron_email }}"
|
2023-04-28 21:25:21 +00:00
|
|
|
- name: Cronmails - Add monthly test mail
|
|
|
|
become: true
|
2021-09-25 21:16:31 +00:00
|
|
|
ansible.builtin.cron:
|
|
|
|
name: "Monthly Test Mail"
|
|
|
|
minute: "0"
|
2021-10-01 18:29:30 +00:00
|
|
|
hour: "0"
|
2021-09-25 21:16:31 +00:00
|
|
|
day: "1"
|
|
|
|
job: echo "Monthly cron test mail"
|