db0b5ab3db
All checks were successful
Ansible Lint |Total|New|Outstanding|Fixed|Trend
|:-:|:-:|:-:|:-:|:-:
|2781|5|2776|4|:-1:
Reference build: <a href="https://jenkins.evolix.org/job/gitea/job/ansible-roles/job/unstable/246//ansiblelint">Evolix » ansible-roles » unstable #246</a>
gitea/ansible-roles/pipeline/head This commit looks good
99 lines
2.2 KiB
YAML
99 lines
2.2 KiB
YAML
---
|
|
|
|
- name: Postfix packages are installed
|
|
ansible.builtin.apt:
|
|
name:
|
|
- postfix
|
|
- mailgraph
|
|
state: present
|
|
tags:
|
|
- packages
|
|
- postfix
|
|
when: evolinux_postfix_packages | bool
|
|
|
|
- name: configure postfix myhostname
|
|
ansible.builtin.lineinfile:
|
|
dest: /etc/postfix/main.cf
|
|
state: present
|
|
line: "myhostname = {{ evolinux_fqdn }}"
|
|
regexp: '^myhostname'
|
|
notify: reload postfix
|
|
tags:
|
|
- postfix
|
|
|
|
- name: configure postfix mynetworks
|
|
ansible.builtin.lineinfile:
|
|
dest: /etc/postfix/main.cf
|
|
state: present
|
|
line: "mydestination = {{ [evolinux_fqdn, evolinux_internal_fqdn] | unique | join(' ') }} localhost.localdomain localhost localhost.$mydomain"
|
|
regexp: '^mydestination'
|
|
notify: reload 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
|
|
|
|
- name: exim4 is absent
|
|
ansible.builtin.apt:
|
|
name:
|
|
- exim4
|
|
- exim4-base
|
|
- exim4-config
|
|
- exim4-daemon-light
|
|
purge: yes
|
|
state: absent
|
|
tags:
|
|
- packages
|
|
- postfix
|
|
when: evolinux_postfix_purge_exim | bool
|
|
|
|
- ansible.builtin.meta: flush_handlers
|