Revert "evolinux-base: include postfix role, move exim4 purge from evolinux-base to postfix role"

This reverts commit a440110cad.
This commit is contained in:
William Hirigoyen 2023-08-31 17:47:49 +02:00
parent e289fd7119
commit 5b63ba112c
5 changed files with 45 additions and 54 deletions

View file

@ -162,6 +162,7 @@ evolinux_postfix_packages: True
evolinux_postfix_users_alias_root: True
evolinux_postfix_mailer_alias_root: True
evolinux_postfix_root_alias: True
evolinux_postfix_purge_exim: True
# logs
@ -231,4 +232,4 @@ evolinux_cron_checkhpraid_frequency: daily
evolinux_motd_include: True
# Utils
evolinux_utils_include: True
evolinux_utils_include: True

View file

@ -1,37 +0,0 @@
#!/bin/bash
#
# Shortcut to show certificate content or enddate.
#
usage() {
echo "Usage : cert [date] <CERT_PATH>"
}
if [ "$#" -eq 1 ]; then
cert_path=$1
if [ -f "${cert_path}" ]; then
openssl x509 -noout -in "${cert_path}" -text
else
>&2 echo "Error, file ${cert_path} does not exist."
fi
elif [ "$#" -eq 2 ]; then
if [ "$1" = "date" ]; then
cert_path=$2
if [ -f "${cert_path}" ]; then
openssl x509 -noout -in "$cert_path" -enddate
else
>&2 echo "Error, file ${cert_path} does not exist."
fi
else
>&2 echo "Error, two arguments provided but 'date' is only allowed as first."
usage
exit 1
fi
else
>&2 echo "Error, more than two arguments provided."
usage
exit 1
fi

View file

@ -1,7 +1,33 @@
---
- ansible.builtin.include_role:
name: evolix/postfix
- 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
@ -55,3 +81,18 @@
- 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

View file

@ -3,4 +3,3 @@ postfix_hostname: "{{ evolinux_fqdn }}"
postfix_force_main_cf: False
postfix_packmail: False
postfix_slow_transport_include: False
postfix_purge_exim: True

View file

@ -9,19 +9,6 @@
tags:
- postfix
- name: exim4 is absent
ansible.builtin.apt:
name:
- exim4
- exim4-base
- exim4-config
- exim4-daemon-light
purge: yes
state: absent
tags:
- postfix
when: postfix_purge_exim | bool
- name: check if main.cf is default
ansible.builtin.shell:
cmd: 'grep -v -E "^(myhostname|mydestination|mailbox_command)" /etc/postfix/main.cf | md5sum -'