Initial commit of exim collection
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

Signed-off-by: Nis Wechselberg <enbewe@enbewe.de>
This commit is contained in:
Nis Wechselberg 2024-06-17 17:27:00 +02:00
commit 8e9e00c15d
Signed by: enbewe
GPG key ID: 7B25171F921B9E57
15 changed files with 317 additions and 0 deletions

View file

@ -0,0 +1,5 @@
---
exim_other_hostnames: '{{ inventory_hostname }}'
exim_local_interfaces: '127.0.0.1 ; ::1'
exim_aliases: []
exim_mail_addresses: []

View file

@ -0,0 +1,25 @@
---
- name: 'Reload exim services'
become: true
ansible.builtin.service:
daemon-reload: true
- name: 'Regenerate aliases'
become: true
ansible.builtin.command:
cmd: 'newaliases'
changed_when: true
- name: 'Regenerate exim config'
become: true
ansible.builtin.command:
cmd: '/usr/sbin/update-exim4.conf'
changed_when: true
notify:
- 'Restart exim service'
- name: 'Restart exim service'
become: true
ansible.builtin.service:
name: 'exim4.service'
state: 'restarted'

48
roles/exim/tasks/main.yml Normal file
View file

@ -0,0 +1,48 @@
---
- name: 'Install required software'
become: true
ansible.builtin.apt:
name: 'exim4-daemon-light'
state: 'present'
- name: 'Deploy exim config config'
become: true
ansible.builtin.template:
src: 'update-exim4.conf.conf.j2'
dest: '/etc/exim4/update-exim4.conf.conf'
owner: 'root'
group: 'root'
mode: 'u=rw,g=r,o=r'
notify:
- 'Regenerate exim config'
- name: 'Deploy client password'
become: true
ansible.builtin.template:
src: 'passwd.client.j2'
dest: '/etc/exim4/passwd.client'
owner: 'root'
group: 'Debian-exim'
mode: 'u=rw,g=r,o='
notify:
- 'Regenerate exim config'
- name: 'Deploy mail senders'
become: true
ansible.builtin.template:
src: 'email-addresses.j2'
dest: '/etc/email-addresses'
owner: 'root'
group: 'root'
mode: 'u=rw,g=r,o=r'
- name: 'Deploy mail aliases'
become: true
ansible.builtin.template:
src: 'aliases.j2'
dest: '/etc/aliases'
owner: 'root'
group: 'root'
mode: 'u=rw,g=r,o=r'
notify:
- 'Regenerate aliases'

View file

@ -0,0 +1,4 @@
# /etc/aliases
{% for mail in exim_aliases %}
{{ mail.user }}:{{ mail.to }}
{% endfor %}

View file

@ -0,0 +1,12 @@
# This is /etc/email-addresses. It is part of the exim package
#
# This file contains email addresses to use for outgoing mail. Any local
# part not in here will be qualified by the system domain as normal.
#
# It should contain lines of the form:
#
#user: someone@isp.com
#otheruser: someoneelse@anotherisp.com
{% for mail in exim_mail_addresses %}
{{ mail.user }}:{{ mail.from }}
{% endfor %}

View file

@ -0,0 +1,8 @@
# password file used when the local exim is authenticating to a remote
# host as a client.
#
# see exim4_passwd_client(5) for more documentation
#
# Example:
### target.mail.server.example:login:password
{{ exim_smarthost_host }}:{{ exim_smarthost_user }}:{{ exim_smarthost_password }}

View file

@ -0,0 +1,31 @@
# /etc/exim4/update-exim4.conf.conf
#
# Edit this file and /etc/mailname by hand and execute update-exim4.conf
# yourself or use 'dpkg-reconfigure exim4-config'
#
# Please note that this is _not_ a dpkg-conffile and that automatic changes
# to this file might happen. The code handling this will honor your local
# changes, so this is usually fine, but will break local schemes that mess
# around with multiple versions of the file.
#
# update-exim4.conf uses this file to determine variable values to generate
# exim configuration macros for the configuration file.
#
# Most settings found in here do have corresponding questions in the
# Debconf configuration, but not all of them.
#
# This is a Debian specific file
dc_eximconfig_configtype='satellite'
dc_other_hostnames='{{ exim_other_hostnames }}'
dc_local_interfaces='{{ exim_local_interfaces }}'
dc_readhost='{{ exim_readhost }}'
dc_relay_domains=''
dc_minimaldns='false'
dc_relay_nets=''
dc_smarthost='{{ exim_smarthost_host }}::{{ exim_smarthost_port }}'
CFILEMODE='644'
dc_use_split_config='false'
dc_hide_mailname='true'
dc_mailname_in_oh='true'
dc_localdelivery='mail_spool'