diff --git a/evolinux-base/defaults/main.yml b/evolinux-base/defaults/main.yml index 90ed4975..e0b6ad6b 100644 --- a/evolinux-base/defaults/main.yml +++ b/evolinux-base/defaults/main.yml @@ -162,7 +162,6 @@ 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 @@ -232,4 +231,4 @@ evolinux_cron_checkhpraid_frequency: daily evolinux_motd_include: True # Utils -evolinux_utils_include: True \ No newline at end of file +evolinux_utils_include: True diff --git a/evolinux-base/files/cert.sh b/evolinux-base/files/cert.sh new file mode 100644 index 00000000..f43a9dad --- /dev/null +++ b/evolinux-base/files/cert.sh @@ -0,0 +1,37 @@ +#!/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 d9dba3e2..c806b49f 100644 --- a/evolinux-base/tasks/postfix.yml +++ b/evolinux-base/tasks/postfix.yml @@ -1,33 +1,7 @@ --- -- 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 +- ansible.builtin.include_role: + name: evolix/postfix tags: - postfix @@ -81,18 +55,3 @@ - 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 8bd15a86..50b0185e 100644 --- a/postfix/defaults/main.yml +++ b/postfix/defaults/main.yml @@ -3,3 +3,4 @@ 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 6c4d3407..82ea77c3 100644 --- a/postfix/tasks/common.yml +++ b/postfix/tasks/common.yml @@ -9,6 +9,19 @@ 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 -'