2016-11-07 14:00:57 +01:00
|
|
|
---
|
|
|
|
|
|
|
|
- name: packages are installed
|
|
|
|
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
|
|
|
|
|
|
|
|
- name: fetch users list
|
|
|
|
shell: getent passwd | cut -d":" -f 1 | grep -v root
|
2017-01-31 11:45:35 +01:00
|
|
|
#check_mode: no (for migration to Ansible 2.2)
|
|
|
|
always_run: yes
|
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
|
|
|
|
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
|