forked from evolix/ansible-roles
evolinux-base: include postfix role, move exim4 purge from evolinux-base to postfix role
This commit is contained in:
parent
bfe3bd7ef4
commit
a440110cad
|
@ -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
|
||||
|
||||
|
|
37
evolinux-base/files/cert.sh
Normal file
37
evolinux-base/files/cert.sh
Normal 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
|
||||
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 -'
|
||||
|
|
Loading…
Reference in a new issue