1
0
Fork 0
mirror of https://github.com/roles-ansible/ansible_role_exim4.git synced 2024-08-16 10:09:49 +02:00

get basic exim4 config running

This commit is contained in:
L3D 2021-02-18 16:53:12 +01:00
parent 8ce7b323fa
commit ea3884e069
Signed by: l3d
GPG key ID: CD08445BFF4313D1
6 changed files with 72 additions and 2 deletions

View file

@ -1,8 +1,20 @@
# ansible_role_exim4
Ansible role to configure exim4 that it will send mail via external smtp server. (smarthost)
Ansible role to configure exim4.
By default you can tell exim4 that it will send mail via smarthost.
This role is a work in proggress!
To do this you have at leaset set the smarthost FQDN in the variable: ``exim4__dc_smarthost:``.
Example Playbook:
----------------
```
- name: run exim4 role
hosts: localhost
roles:
- {role: dansible_role_exim, tags: exim4}
vars:
exim4__dc_smarthost: mx01.example.com
```
Testing
----------

View file

@ -1,5 +1,22 @@
---
exim4__state: present
# please set the smarthost you wnt to use to send mails
exim4__dc_smarthost: "{{sansible_fqdn }}"
# you can adjust the other exim4 settings, if you want
exim4__dc_eximconfig_configtype: 'satellite'
exim4__dc_other_hostnames: "{{ hostname }}"
exim4__dc_local_interfaces: '127.0.0.1 ; ::1'
exim4__dc_readhost: "{{ hostname }}"
exim4__dc_relay_domains: ''
exim4__dc_minimaldns: false
exim4__dc_relay_nets: ''
exim4__CFILEMODE: '644'
exim4__dc_use_split_config: 'false'
exim4__dc_hide_mailname: 'true'
exim4__dc_mailname_in_oh: 'true'
exim4__dc_localdelivery: 'mail_spool'
# should we do a version check? (recomended)
submodules_versioncheck: false

6
handlers/main.yml Normal file
View file

@ -0,0 +1,6 @@
---
- name: systemctl restart exim4
become: true
ansible.builtin.systemd:
name: "{{ exim4__daemon }}"
state: restarted

10
tasks/configuration.yml Normal file
View file

@ -0,0 +1,10 @@
---
- name: Configure exim4 (Debian)
become: true
ansible.builtin.template:
src: 'templates/exim4.conf.j2'
dest: "{{ exim4__configuration_file }}"
mode: 0644
owner: root
group: root
notify: systemctl restart exim4

View file

@ -15,3 +15,12 @@
- name: exim4 installation
ansible.builtin.include_tasks: installation.yml
- name: exim4 configuration
ansible.builtin.include_tasks: configuration.yml
- name: systemctl start exim4
become: true
ansible.builtin.systemd:
name: "{{ exim4__daemon }}"
state: started

16
templates/exim4.conf.j2 Normal file
View file

@ -0,0 +1,16 @@
# exim4 config file
# {{ ansible_managed }}
# {{ exim4__configuration_file }}
dc_eximconfig_configtype='{{ exim4__dc_eximconfig_configtype }}'
dc_other_hostnames='{{ exim4__dc_other_hostnames }}'
dc_local_interfaces='{{ exim4__dc_local_interfaces }}'
dc_readhost='{{ exim4__dc_readhost }}'
dc_relay_domains='{{ exim4__dc_relay_domains }}'
dc_minimaldns='{{ exim4__dc_minimaldns|ternary('true', 'false') }}'
dc_relay_nets='{{ exim4__dc_relay_nets }}'
dc_smarthost='{{ exim4__dc_smarthost }}'
CFILEMODE='{{ exim4__CFILEMODE }}'
dc_use_split_config='{{ exim4__dc_use_split_config|ternary('true', 'false') }}'
dc_hide_mailname='{{ exim4__dc_hide_mailname|ternary('true', 'false') }}'
dc_mailname_in_oh='{{ exim4__dc_mailname_in_oh|ternary('true', 'false') }}'
dc_localdelivery='{{ exim4__dc_localdelivery }}'