diff --git a/evolinux-base/defaults/main.yml b/evolinux-base/defaults/main.yml index e0b6ad6b..90ed4975 100644 --- a/evolinux-base/defaults/main.yml +++ b/evolinux-base/defaults/main.yml @@ -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 \ No newline at end of file diff --git a/evolinux-base/files/cert.sh b/evolinux-base/files/cert.sh deleted file mode 100644 index f43a9dad..00000000 --- a/evolinux-base/files/cert.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/bash -# -# Shortcut to show certificate content or enddate. -# - -usage() { - echo "Usage : cert [date] " -} - -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 - diff --git a/evolinux-base/tasks/postfix.yml b/evolinux-base/tasks/postfix.yml index c806b49f..d9dba3e2 100644 --- a/evolinux-base/tasks/postfix.yml +++ b/evolinux-base/tasks/postfix.yml @@ -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 diff --git a/postfix/defaults/main.yml b/postfix/defaults/main.yml index 50b0185e..8bd15a86 100644 --- a/postfix/defaults/main.yml +++ b/postfix/defaults/main.yml @@ -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 diff --git a/postfix/tasks/common.yml b/postfix/tasks/common.yml index 82ea77c3..6c4d3407 100644 --- a/postfix/tasks/common.yml +++ b/postfix/tasks/common.yml @@ -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 -'