2016-11-07 14:00:57 +01:00
|
|
|
---
|
|
|
|
|
2017-10-06 00:21:44 +02:00
|
|
|
- name: Postfix packages are installed
|
2016-11-07 14:00:57 +01:00
|
|
|
apt:
|
|
|
|
name: "{{ item }}"
|
|
|
|
state: present
|
|
|
|
with_items:
|
|
|
|
- postfix
|
|
|
|
- mailgraph
|
2017-01-03 16:37:23 +01:00
|
|
|
when: evolinux_postfix_packages
|
2016-11-07 14:00:57 +01:00
|
|
|
tags:
|
|
|
|
- packages
|
|
|
|
- postfix
|
|
|
|
|
2017-04-25 15:50:22 +02:00
|
|
|
- name: configure postfix myhostname
|
|
|
|
lineinfile:
|
|
|
|
dest: /etc/postfix/main.cf
|
|
|
|
state: present
|
2017-04-27 10:41:18 +02:00
|
|
|
line: "myhostname = {{ evolinux_fqdn }}"
|
2017-04-25 15:50:22 +02:00
|
|
|
regexp: '^myhostname'
|
2017-04-27 10:41:18 +02:00
|
|
|
notify: reload postfix
|
2017-04-25 15:50:22 +02:00
|
|
|
tags:
|
|
|
|
- postfix
|
|
|
|
|
|
|
|
- name: configure postfix mynetworks
|
|
|
|
lineinfile:
|
|
|
|
dest: /etc/postfix/main.cf
|
|
|
|
state: present
|
2018-08-16 16:17:26 +02:00
|
|
|
line: "mydestination = {{ [evolinux_fqdn, evolinux_internal_fqdn] | unique | join(' ') }} localhost.localdomain localhost"
|
2017-04-25 15:50:22 +02:00
|
|
|
regexp: '^mydestination'
|
2017-04-27 10:41:18 +02:00
|
|
|
notify: reload postfix
|
2017-04-25 15:50:22 +02:00
|
|
|
tags:
|
|
|
|
- postfix
|
|
|
|
|
2016-11-07 14:00:57 +01:00
|
|
|
- name: fetch users list
|
|
|
|
shell: getent passwd | cut -d":" -f 1 | grep -v root
|
2017-03-24 14:15:09 +01:00
|
|
|
check_mode: no
|
2017-05-02 13:52:39 +02:00
|
|
|
|
2016-11-07 14:00:57 +01:00
|
|
|
register: non_root_users_list
|
|
|
|
changed_when: False
|
|
|
|
tags:
|
|
|
|
- postfix
|
|
|
|
|
|
|
|
- name: each user is aliased to root
|
|
|
|
lineinfile:
|
|
|
|
dest: /etc/aliases
|
|
|
|
regexp: "^{{ item }}:.*"
|
|
|
|
line: "{{ item }}: root"
|
|
|
|
with_items: "{{ non_root_users_list.stdout_lines }}"
|
|
|
|
notify: newaliases
|
2017-01-03 16:37:23 +01:00
|
|
|
when: evolinux_postfix_users_alias_root
|
2016-11-07 14:00:57 +01:00
|
|
|
tags:
|
|
|
|
- postfix
|
|
|
|
|
|
|
|
- name: additional users address aliased to root
|
|
|
|
lineinfile:
|
|
|
|
dest: /etc/aliases
|
|
|
|
regexp: "^{{ item }}:.*"
|
|
|
|
line: "{{ item }}: root"
|
|
|
|
with_items:
|
|
|
|
- postmaster
|
|
|
|
- abuse
|
|
|
|
- mailer-daemon
|
2018-06-25 11:19:34 +02:00
|
|
|
- delay
|
|
|
|
- error
|
|
|
|
- bounce
|
2016-11-07 14:00:57 +01:00
|
|
|
notify: newaliases
|
2017-01-03 16:37:23 +01:00
|
|
|
when: evolinux_postfix_mailer_alias_root
|
2016-11-07 14:00:57 +01:00
|
|
|
tags:
|
|
|
|
- postfix
|
|
|
|
|
|
|
|
- name: root alias is configured
|
|
|
|
lineinfile:
|
|
|
|
dest: /etc/aliases
|
|
|
|
regexp: "^root:"
|
|
|
|
line: "root: {{ postfix_alias_email or general_alert_email | mandatory }}"
|
|
|
|
notify: newaliases
|
2017-01-03 16:37:23 +01:00
|
|
|
when: evolinux_postfix_root_alias
|
2016-11-07 14:00:57 +01:00
|
|
|
tags:
|
|
|
|
- postfix
|
|
|
|
|
2017-01-02 00:32:29 +01:00
|
|
|
- meta: flush_handlers
|
|
|
|
|
2016-11-07 14:00:57 +01:00
|
|
|
- name: exim4 is absent
|
|
|
|
apt:
|
|
|
|
name: "{{ item }}"
|
|
|
|
purge: yes
|
|
|
|
state: absent
|
|
|
|
with_items:
|
|
|
|
- exim4
|
|
|
|
- exim4-base
|
|
|
|
- exim4-config
|
|
|
|
- exim4-daemon-light
|
2017-01-02 00:32:29 +01:00
|
|
|
when: evolinux_postfix_purge_exim
|
2016-11-07 14:00:57 +01:00
|
|
|
tags:
|
|
|
|
- packages
|
|
|
|
- postfix
|
2017-01-03 17:02:23 +01:00
|
|
|
|
|
|
|
- meta: flush_handlers
|