2016-11-07 14:00:57 +01:00
|
|
|
---
|
|
|
|
|
|
|
|
- name: fetch users list
|
2023-03-18 18:35:54 +01:00
|
|
|
ansible.builtin.shell:
|
|
|
|
cmd: "set -o pipefail && getent passwd | cut -d':' -f 1 | grep -v root"
|
2021-05-18 14:04:54 +02:00
|
|
|
executable: /bin/bash
|
2017-03-24 14:15:09 +01:00
|
|
|
check_mode: no
|
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
|
2023-03-18 18:35:54 +01:00
|
|
|
ansible.builtin.lineinfile:
|
2016-11-07 14:00:57 +01:00
|
|
|
dest: /etc/aliases
|
|
|
|
regexp: "^{{ item }}:.*"
|
|
|
|
line: "{{ item }}: root"
|
2021-05-04 14:18:40 +02:00
|
|
|
loop: "{{ non_root_users_list.stdout_lines }}"
|
2016-11-07 14:00:57 +01:00
|
|
|
notify: newaliases
|
|
|
|
tags:
|
|
|
|
- postfix
|
2023-03-18 18:35:54 +01:00
|
|
|
when: evolinux_postfix_users_alias_root | bool
|
2016-11-07 14:00:57 +01:00
|
|
|
|
|
|
|
- name: additional users address aliased to root
|
2023-03-18 18:35:54 +01:00
|
|
|
ansible.builtin.lineinfile:
|
2016-11-07 14:00:57 +01:00
|
|
|
dest: /etc/aliases
|
|
|
|
regexp: "^{{ item }}:.*"
|
|
|
|
line: "{{ item }}: root"
|
2021-05-04 14:18:40 +02:00
|
|
|
loop:
|
2016-11-07 14:00:57 +01:00
|
|
|
- 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
|
|
|
|
tags:
|
|
|
|
- postfix
|
2023-03-18 18:35:54 +01:00
|
|
|
when: evolinux_postfix_mailer_alias_root | bool
|
2016-11-07 14:00:57 +01:00
|
|
|
|
|
|
|
- name: root alias is configured
|
2023-03-18 18:35:54 +01:00
|
|
|
ansible.builtin.lineinfile:
|
2016-11-07 14:00:57 +01:00
|
|
|
dest: /etc/aliases
|
|
|
|
regexp: "^root:"
|
|
|
|
line: "root: {{ postfix_alias_email or general_alert_email | mandatory }}"
|
|
|
|
notify: newaliases
|
|
|
|
tags:
|
|
|
|
- postfix
|
2023-03-18 18:35:54 +01:00
|
|
|
when: evolinux_postfix_root_alias | bool
|
2016-11-07 14:00:57 +01:00
|
|
|
|
2023-03-18 18:35:54 +01:00
|
|
|
- ansible.builtin.meta: flush_handlers
|
2017-01-02 00:32:29 +01:00
|
|
|
|