ansible-roles/evolinux-base/tasks/postfix.yml
William Hirigoyen a440110cad
All checks were successful
Ansible Lint |Total|New|Outstanding|Fixed|Trend |:-:|:-:|:-:|:-:|:-: |2620|19|2601|21|:+1: Reference build: <a href="https://jenkins.evolix.org/job/gitea/job/ansible-roles/job/unstable/336//ansiblelint">Evolix » ansible-roles » unstable #336</a>
gitea/ansible-roles/pipeline/head This commit looks good
evolinux-base: include postfix role, move exim4 purge from evolinux-base to postfix role
2023-08-31 17:30:34 +02:00

58 lines
1.3 KiB
YAML

---
- ansible.builtin.include_role:
name: evolix/postfix
tags:
- postfix
- name: fetch users list
ansible.builtin.shell:
cmd: "set -o pipefail && getent passwd | cut -d':' -f 1 | grep -v root"
executable: /bin/bash
check_mode: no
register: non_root_users_list
changed_when: False
tags:
- postfix
- name: each user is aliased to root
ansible.builtin.lineinfile:
dest: /etc/aliases
regexp: "^{{ item }}:.*"
line: "{{ item }}: root"
loop: "{{ non_root_users_list.stdout_lines }}"
notify: newaliases
tags:
- postfix
when: evolinux_postfix_users_alias_root | bool
- name: additional users address aliased to root
ansible.builtin.lineinfile:
dest: /etc/aliases
regexp: "^{{ item }}:.*"
line: "{{ item }}: root"
loop:
- postmaster
- abuse
- mailer-daemon
- delay
- error
- bounce
notify: newaliases
tags:
- postfix
when: evolinux_postfix_mailer_alias_root | bool
- name: root alias is configured
ansible.builtin.lineinfile:
dest: /etc/aliases
regexp: "^root:"
line: "root: {{ postfix_alias_email or general_alert_email | mandatory }}"
notify: newaliases
tags:
- postfix
when: evolinux_postfix_root_alias | bool
- ansible.builtin.meta: flush_handlers