Cronmails: Fix rejected mails b/c of non FQDNs in sender

This commit is contained in:
Jannik Beyerstedt 2021-09-25 23:16:31 +02:00
parent 42a2bd8a60
commit d6fee609e4
5 changed files with 19 additions and 3 deletions

View File

@ -36,6 +36,7 @@ Mandatory variable:
### Cronmails
Mandatory variable:
- `cron_email`: Sender email address used by cron
- `exim_etc_mailname`: Exim4 /etc/mailname (default: inventory_hostname)
### Docker
Optional variable:

View File

@ -11,3 +11,5 @@ telegraf_unifi_file: "telegraf-UniFi.conf.j2"
telegraf_airmax_file: "telegraf-AirMAX.conf.j2"
dockercompose_use_pip: false
exim_etc_mailname: "{{ inventory_hostname }}"

View File

@ -30,13 +30,19 @@
src: "{{ role_path }}/templates/update-exim4.conf.conf"
dest: /etc/exim4/update-exim4.conf.conf
register: cronmails_conffile_update
- name: cronmails - Set /etc/mailname
become: yes
ansible.builtin.copy:
dest: /etc/mailname
content: "{{ exim_etc_mailname }}"
register: cronmails_mailname_update
- name: cronmails - Run update-exim4.conf
become: yes
ansible.builtin.shell: "update-exim4.conf"
when: cronmails_conftmp_update.changed or cronmails_conffile_update.changed
when: cronmails_conftmp_update.changed or cronmails_conffile_update.changed or cronmails_mailname_update.changed
- name: cronmails - Enable and start exim4
become: yes
ansible.builtin.service:
name: exim4
state: started
state: restarted
enabled: yes

View File

@ -23,3 +23,10 @@
name: MAILTO
env: yes
value: "{{ cron_email }}"
- name: cronmails - Add monthly test mail
become: yes
ansible.builtin.cron:
name: "Monthly Test Mail"
minute: "0"
day: "1"
job: echo "Monthly cron test mail"

View File

@ -17,7 +17,7 @@
# This is a Debian specific file
dc_eximconfig_configtype='internet'
dc_other_hostnames='{{ ansible_hostname }}, localhost.localdomain, localhost'
dc_other_hostnames='{{ inventory_hostname }}, localhost.localdomain, localhost'
dc_local_interfaces='127.0.0.1 ; ::1'
dc_readhost=''
dc_relay_domains=''