2020-03-08 15:41:55 +00:00
|
|
|
---
|
|
|
|
# Server/Cronmails: Setup Mails from Cronjobs (install exim) - Debian Version
|
|
|
|
|
|
|
|
# Install exim
|
2023-04-28 21:25:21 +00:00
|
|
|
- name: Cronmails - Install exim4 as MTA
|
|
|
|
become: true
|
2021-08-28 14:50:37 +00:00
|
|
|
ansible.builtin.apt:
|
2020-03-08 15:41:55 +00:00
|
|
|
name: "{{ packages }}"
|
|
|
|
state: present
|
|
|
|
vars:
|
|
|
|
packages:
|
|
|
|
- exim4
|
|
|
|
- mailutils
|
2023-04-28 21:25:21 +00:00
|
|
|
diff: false
|
2020-03-08 16:56:50 +00:00
|
|
|
|
|
|
|
# Configure exim
|
2023-04-28 21:25:21 +00:00
|
|
|
- name: Cronmails - Create exim4 config folder
|
|
|
|
become: true
|
2021-08-28 14:50:37 +00:00
|
|
|
ansible.builtin.file:
|
2020-03-08 16:56:50 +00:00
|
|
|
path: /etc/exim4
|
|
|
|
state: directory
|
2023-04-28 21:25:21 +00:00
|
|
|
- name: Cronmails - Copy exim4 config template
|
|
|
|
become: true
|
2021-08-28 14:50:37 +00:00
|
|
|
ansible.builtin.copy:
|
2020-03-08 16:56:50 +00:00
|
|
|
src: "{{ role_path }}/files/exim4.conf.template"
|
|
|
|
dest: /etc/exim4/exim4.conf.template
|
|
|
|
register: cronmails_conftmp_update
|
2023-04-28 21:25:21 +00:00
|
|
|
- name: Cronmails - Copy exim4 config file
|
|
|
|
become: true
|
2021-08-28 14:50:37 +00:00
|
|
|
ansible.builtin.template:
|
2020-03-08 16:56:50 +00:00
|
|
|
src: "{{ role_path }}/templates/update-exim4.conf.conf"
|
|
|
|
dest: /etc/exim4/update-exim4.conf.conf
|
|
|
|
register: cronmails_conffile_update
|
2023-04-28 21:25:21 +00:00
|
|
|
- name: Cronmails - Set /etc/mailname
|
|
|
|
become: true
|
2021-09-25 21:16:31 +00:00
|
|
|
ansible.builtin.copy:
|
|
|
|
dest: /etc/mailname
|
|
|
|
content: "{{ exim_etc_mailname }}"
|
|
|
|
register: cronmails_mailname_update
|
2023-04-28 21:25:21 +00:00
|
|
|
- name: Cronmails - Run update-exim4.conf
|
2022-02-13 19:52:02 +00:00
|
|
|
when: cronmails_conftmp_update.changed or cronmails_conffile_update.changed or cronmails_mailname_update.changed
|
2023-04-28 21:25:21 +00:00
|
|
|
become: true
|
2021-08-28 14:50:37 +00:00
|
|
|
ansible.builtin.shell: "update-exim4.conf"
|
2023-04-28 21:25:21 +00:00
|
|
|
- name: Cronmails - Enable and start exim4
|
|
|
|
become: true
|
2021-08-28 14:50:37 +00:00
|
|
|
ansible.builtin.service:
|
2020-03-08 16:56:50 +00:00
|
|
|
name: exim4
|
2021-09-25 21:16:31 +00:00
|
|
|
state: restarted
|
2023-04-28 21:25:21 +00:00
|
|
|
enabled: true
|