evolinux-base: include postfix role, move exim4 purge from evolinux-base to postfix role
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

This commit is contained in:
William Hirigoyen 2023-08-31 17:30:14 +02:00
parent bfe3bd7ef4
commit a440110cad
5 changed files with 54 additions and 45 deletions

View file

@ -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
evolinux_utils_include: True

View file

@ -0,0 +1,37 @@
#!/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,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

View file

@ -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

View file

@ -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 -'