2024-09-24 07:38:05 +00:00
|
|
|
- name: Install exim packages
|
2024-09-23 12:30:38 +00:00
|
|
|
apt:
|
|
|
|
name: exim4
|
|
|
|
state: present
|
2024-09-24 08:25:40 +00:00
|
|
|
- name: Prepare exim configuration
|
2024-02-12 09:21:35 +00:00
|
|
|
lineinfile:
|
2024-09-23 14:32:28 +00:00
|
|
|
dest: /etc/exim4/update-exim4.conf.conf
|
2024-02-12 09:21:35 +00:00
|
|
|
regexp: "{{ item.regexp }}"
|
|
|
|
line: "{{ item.line }}"
|
|
|
|
state: present
|
|
|
|
mode: 0644
|
|
|
|
with_items:
|
|
|
|
- regexp: '^dc_eximconfig_configtype'
|
2024-09-30 06:07:30 +00:00
|
|
|
line: "dc_eximconfig_configtype='satellite'"
|
2024-02-12 09:21:35 +00:00
|
|
|
- regexp: '^dc_other_hostnames'
|
2024-09-30 06:07:30 +00:00
|
|
|
line: "dc_other_hostnames='{{ ansible_fqdn }}'"
|
2024-02-12 09:21:35 +00:00
|
|
|
- regexp: '^dc_local_interfaces'
|
2024-09-30 06:07:30 +00:00
|
|
|
line: "dc_local_interfaces='127.0.0.1'"
|
2024-02-12 09:21:35 +00:00
|
|
|
- regexp: '^dc_readhost'
|
2024-09-30 06:07:30 +00:00
|
|
|
line: "dc_readhost='{{ ansible_fqdn }}'"
|
2024-02-12 09:21:35 +00:00
|
|
|
- regexp: '^dc_relay_domains'
|
2024-09-30 06:07:30 +00:00
|
|
|
line: "dc_relay_domains=''"
|
2024-02-12 09:21:35 +00:00
|
|
|
- regexp: '^dc_minimaldns'
|
2024-09-30 06:07:30 +00:00
|
|
|
line: "dc_minimaldns='false'"
|
2024-02-12 09:21:35 +00:00
|
|
|
- regexp: '^dc_relay_nets'
|
2024-09-30 06:07:30 +00:00
|
|
|
line: "dc_relay_nets=''"
|
2024-02-12 09:21:35 +00:00
|
|
|
- regexp: '^dc_smarthost'
|
2024-09-30 06:07:30 +00:00
|
|
|
line: "dc_smarthost='{{ smtp_server }}'"
|
2024-02-12 09:21:35 +00:00
|
|
|
- regexp: '^CFILEMODE'
|
2024-09-30 06:07:30 +00:00
|
|
|
line: "CFILEMODE='644'"
|
2024-02-12 09:21:35 +00:00
|
|
|
- regexp: '^dc_use_split_config'
|
2024-09-30 06:07:30 +00:00
|
|
|
line: "dc_use_split_config='false'"
|
2024-02-12 09:21:35 +00:00
|
|
|
- regexp: '^dc_hide_mailname'
|
2024-09-30 06:07:30 +00:00
|
|
|
line: "dc_hide_mailname='true'"
|
2024-02-12 09:21:35 +00:00
|
|
|
- regexp: '^dc_mailname_in_oh'
|
2024-09-30 06:07:30 +00:00
|
|
|
line: "dc_mailname_in_oh='true'"
|
2024-02-12 09:21:35 +00:00
|
|
|
- regexp: '^dc_localdelivery'
|
2024-09-30 06:07:30 +00:00
|
|
|
line: "dc_localdelivery='mail_spool'"
|
2024-09-23 12:30:38 +00:00
|
|
|
notify: restart-exim
|
2024-09-24 08:25:40 +00:00
|
|
|
register: exim_config
|
|
|
|
- name: Update exim configuration
|
|
|
|
command: update-exim4.conf
|
|
|
|
when: exim_config.changed
|
|
|
|
- name: Sending mail to verify relay host configuration works
|
|
|
|
shell: >
|
|
|
|
echo "If you see this message, relayhost on {{ ansible_fqdn }} has been configured correctly." \
|
|
|
|
| mailx -s "Relayhost test for {{ ansible_fqdn }}" "{{ sysadmin_mail }}"
|
|
|
|
when: exim_config.changed
|