ansible-role-server/tasks/cronmails.yml

35 lines
1 KiB
YAML
Raw Normal View History

---
# Server/Cronmails: Setup Mails from Cronjobs (install exim)
# Install and configure exim
- name: cronmails - Install exim4
when: not exim_skip_install
ansible.builtin.include_tasks: "{{ item }}"
with_first_found:
- "cronmails-{{ ansible_distribution }}.{{ ansible_distribution_release }}.yml"
- "cronmails-{{ ansible_distribution }}.yml"
2020-03-08 16:56:50 +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
# Set cronjob env variables/ settings
- name: cronmails - Crontab set path
become: yes
ansible.builtin.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
ansible.builtin.cron:
name: MAILTO
env: yes
value: "{{ cron_email }}"
- name: cronmails - Add monthly test mail
become: yes
ansible.builtin.cron:
name: "Monthly Test Mail"
minute: "0"
2021-10-01 18:29:30 +00:00
hour: "0"
day: "1"
job: echo "Monthly cron test mail"