Compare commits
11 Commits
Author | SHA1 | Date |
---|---|---|
CASSONNET Guillaume | 6a87854b47 | |
CASSONNET Guillaume | d669ce9dfe | |
Gitouche | 8954e574bf | |
Gitouche | 7f0ea55dc6 | |
Gitouche | 8844cf5a87 | |
Gitouche | 8159ec6030 | |
Gitouche | 59b11898e4 | |
Gitouche | 5f8bf17901 | |
Gitouche | 69ec605d5a | |
Gitouche | 40be77d9db | |
Gitouche | 356ccc9847 |
|
@ -1,7 +1,12 @@
|
|||
---
|
||||
msmtp_version: 1.8.23-1
|
||||
msmtp_version: 1.8.25-1
|
||||
msmtp_rpm_file: https://git.garbaye.fr/api/packages/Garbaye/generic/msmtp/{{ msmtp_version}}/msmtp-{{ msmtp_version}}.el8.{{ ansible_architecture }}.rpm
|
||||
|
||||
# msmtprc configuration
|
||||
msmtp_auth: 'on'
|
||||
msmtp_tls: 'on'
|
||||
msmtp_tls_starttls: 'on'
|
||||
|
||||
msmtp_accounts:
|
||||
# Account 1 - it was a real account for testing (but yandex now blocks it)
|
||||
# Uses Yandex app password limited to POP3, SMTP and IMAP
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
FROMFEDORA='37'
|
||||
PACKAGE='msmtp'
|
||||
|
||||
ABSDIR="$( dirname "$(readlink -f -- "$0")" )"
|
||||
cd ${ABSDIR}
|
||||
|
||||
type -P docker >/dev/null && DOCKER=$(which docker)
|
||||
type -P podman >/dev/null && DOCKER=$(which podman)
|
||||
|
||||
get_src_rpm_url() {
|
||||
local __package=${1}
|
||||
local __resultvar=${2}
|
||||
if ! local __jsonline=$(curl -s https://src.fedoraproject.org/_dg/bodhi_updates/rpms/${1} | grep -e "fc${FROMFEDORA}\","); then
|
||||
echo "ERROR : No ${1} release available for Fedora ${FROMFEDORA}"
|
||||
echo "Please check https://src.fedoraproject.org/rpms/${PACKAGE} to choose the right release."
|
||||
exit 1
|
||||
fi
|
||||
local __version=$(echo "${__jsonline}" | sed -e "s/^\s*\"stable\": \"${1}-\(.*\)\.fc${FROMFEDORA}\",\s*$/\1/")
|
||||
for repo in releases updates; do
|
||||
local __url=https://dl.fedoraproject.org/pub/fedora/linux/${repo}/${FROMFEDORA}/Everything/source/tree/Packages/${__package::1}/${__package}-${__version}.fc${FROMFEDORA}.src.rpm
|
||||
if curl -sSLfI ${__url} 1>/dev/null 2>/dev/null; then
|
||||
eval $__resultvar="'${__url}'"
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
exit 1
|
||||
}
|
||||
|
||||
get_src_rpm_url ${PACKAGE} PACKAGE_SRC_RPM_URL
|
||||
get_src_rpm_url gettext GETTEXT_SRC_RPM_URL
|
||||
|
||||
ARCH=$(${DOCKER} run --rm docker.io/library/rockylinux:8 uname -i)
|
||||
|
||||
mkdir /tmp/dockerrpmbuild-$$
|
||||
|
||||
${DOCKER} run -i --rm -v /tmp/dockerrpmbuild-$$:/out:Z --privileged docker.io/library/rockylinux:8 <<EOF
|
||||
dnf install -qy epel-release
|
||||
dnf install -qy mock
|
||||
useradd mockbuilder
|
||||
usermod -a -G mock mockbuilder
|
||||
runuser -l mockbuilder -c 'mock --localrepo=/tmp/ --chain -r rocky+epel-8-${ARCH} ${GETTEXT_SRC_RPM_URL} ${PACKAGE_SRC_RPM_URL}'
|
||||
mv -f /tmp/results/*/${PACKAGE}-*/*.rpm /out/
|
||||
EOF
|
||||
|
||||
[[ $? == 0 ]] && mv -i /tmp/dockerrpmbuild-$$/*.rpm ${ABSDIR}/files/ && rm -rf /tmp/dockerrpmbuild-$$
|
|
@ -1,54 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
FROMFEDORA='36'
|
||||
PACKAGE='msmtp'
|
||||
GETTEXT_FC='34'
|
||||
GETTEXT_VERSION='0.21-4'
|
||||
|
||||
ABSDIR="$( dirname "$(readlink -f -- "$0")" )"
|
||||
cd ${ABSDIR}
|
||||
|
||||
type -P docker >/dev/null && DOCKER=$(which docker)
|
||||
type -P podman >/dev/null && DOCKER=$(which podman)
|
||||
|
||||
if ! JSONLINE=$(curl -s https://src.fedoraproject.org/_dg/bodhi_updates/rpms/${PACKAGE} | grep -e "fc${FROMFEDORA}\","); then
|
||||
echo "ERROR : No ${PACKAGE} release available for Fedora ${FROMFEDORA}"
|
||||
echo "Please check https://src.fedoraproject.org/rpms/${PACKAGE} to choose the right release."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
VERSION=$(echo "${JSONLINE}" | sed -e "s/^\s*\"stable\": \"${PACKAGE}-\(.*\)\.fc${FROMFEDORA}\",\s*$/\1/")
|
||||
|
||||
ARCH=$(${DOCKER} run --rm docker.io/library/rockylinux:8 uname -i)
|
||||
|
||||
${DOCKER} build -t localhost/docker-${PACKAGE}-build -f- . <<EOF
|
||||
FROM docker.io/library/rockylinux:8
|
||||
RUN dnf install -y epel-release dnf-plugins-core && \
|
||||
dnf config-manager --set-enabled powertools && \
|
||||
dnf install -y rpm-build gcc make gettext gnutls-devel libgsasl-devel libidn-devel libsecret-devel autoconf automake emacs gcc-c++ glibc-langpack-de glibc-langpack-fa glibc-langpack-fr glibc-langpack-ja glibc-langpack-tr glibc-langpack-zh libacl-devel libunistring-devel libxml2-devel ncurses-devel teckit texinfo-tex texlive-dvipdfmx texlive-dvips texlive-xetex git && \
|
||||
useradd -m dontbuildasroot -s /bin/bash
|
||||
USER dontbuildasroot
|
||||
RUN rpmbuild --rebuild https://dl.fedoraproject.org/pub/archive/fedora/linux/releases/${GETTEXT_FC}/Everything/source/tree/Packages/g/gettext-${GETTEXT_VERSION}.fc${GETTEXT_FC}.src.rpm
|
||||
USER root
|
||||
RUN rpm -Uvh /home/dontbuildasroot/rpmbuild/RPMS/x86_64/gettext-devel-${GETTEXT_VERSION}.el8.x86_64.rpm \
|
||||
/home/dontbuildasroot/rpmbuild/RPMS/x86_64/gettext-libs-${GETTEXT_VERSION}.el8.x86_64.rpm \
|
||||
/home/dontbuildasroot/rpmbuild/RPMS/x86_64/gettext-${GETTEXT_VERSION}.el8.x86_64.rpm \
|
||||
/home/dontbuildasroot/rpmbuild/RPMS/noarch/gettext-common-devel-${GETTEXT_VERSION}.el8.noarch.rpm \
|
||||
/home/dontbuildasroot/rpmbuild/RPMS/x86_64/libtextstyle-${GETTEXT_VERSION}.el8.x86_64.rpm
|
||||
USER dontbuildasroot
|
||||
RUN rpmbuild --rebuild https://download-ib01.fedoraproject.org/pub/fedora/linux/updates/${FROMFEDORA}/Everything/source/tree/Packages/m/${PACKAGE}-${VERSION}.fc${FROMFEDORA}.src.rpm
|
||||
EOF
|
||||
|
||||
[[ $? = 0 ]] && mkdir /tmp/dockerrpmbuild-$$
|
||||
|
||||
${DOCKER} build --no-cache -v /tmp/dockerrpmbuild-$$:/out:Z -t docker-${PACKAGE}-xfer -f- . <<EOF
|
||||
FROM localhost/docker-${PACKAGE}-build
|
||||
USER root
|
||||
RUN mv -f /home/dontbuildasroot/rpmbuild/RPMS/*/*.rpm /out/
|
||||
EOF
|
||||
|
||||
[[ $? == 0 ]] && mv -i /tmp/dockerrpmbuild-$$/*.rpm ${ABSDIR}/files/ &&
|
||||
rm -rf /tmp/dockerrpmbuild-$$ &&
|
||||
|
||||
${DOCKER} rmi -f docker-${PACKAGE}-build &&
|
||||
${DOCKER} rmi -f docker-${PACKAGE}-xfer
|
|
@ -4,4 +4,4 @@
|
|||
tasks:
|
||||
- name: "Include ansible_msmtp_mailer"
|
||||
include_role:
|
||||
name: "ansible_msmtp_mailer"
|
||||
name: "ansible-msmtp-mailer"
|
||||
|
|
|
@ -8,14 +8,6 @@ lint: |
|
|||
yamllint .
|
||||
ansible-lint
|
||||
platforms:
|
||||
- name: centos8
|
||||
image: geerlingguy/docker-centos8-ansible:latest
|
||||
command: ""
|
||||
volumes:
|
||||
- /sys/fs/cgroup:/sys/fs/cgroup:ro
|
||||
capabilities:
|
||||
- SYS_ADMIN
|
||||
pre_build_image: true
|
||||
- name: rockylinux8
|
||||
image: geerlingguy/docker-rockylinux8-ansible:latest
|
||||
command: ""
|
||||
|
@ -24,7 +16,15 @@ platforms:
|
|||
capabilities:
|
||||
- SYS_ADMIN
|
||||
pre_build_image: true
|
||||
- name: rockylinux9
|
||||
image: geerlingguy/docker-rockylinux9-ansible:latest
|
||||
command: ""
|
||||
volumes:
|
||||
- /sys/fs/cgroup:/sys/fs/cgroup:ro
|
||||
capabilities:
|
||||
- SYS_ADMIN
|
||||
pre_build_image: true
|
||||
provisioner:
|
||||
name: ansible
|
||||
vefifier:
|
||||
verifier:
|
||||
name: ansible
|
||||
|
|
|
@ -1,10 +1,16 @@
|
|||
---
|
||||
- name: Copy systemd unit file to server
|
||||
copy:
|
||||
src: msmtpd.service
|
||||
dest: /etc/systemd/system/msmtpd.service
|
||||
mode: 0400
|
||||
when: ansible_os_family == "RedHat"
|
||||
- name: Include tasks depending on OS
|
||||
ansible.builtin.include_tasks:
|
||||
file: "{{ item }}"
|
||||
apply:
|
||||
tags:
|
||||
- wg-install
|
||||
with_first_found:
|
||||
- "setup-{{ ansible_distribution | lower }}-{{ ansible_distribution_major_version }}.yml"
|
||||
- "setup-{{ ansible_distribution | lower }}-{{ ansible_distribution_version }}.yml"
|
||||
- "setup-{{ ansible_distribution | lower }}-{{ ansible_distribution_release }}.yml"
|
||||
- "setup-{{ ansible_distribution | lower }}.yml"
|
||||
- "setup-{{ ansible_os_family | lower }}.yml"
|
||||
|
||||
- name: Ensure group "msmtp" exists
|
||||
group:
|
||||
|
@ -12,16 +18,11 @@
|
|||
state: present
|
||||
when: ansible_os_family == "RedHat"
|
||||
|
||||
- name: Install msmtp
|
||||
yum:
|
||||
name:
|
||||
- "{{ msmtp_rpm_file }}"
|
||||
- mailx
|
||||
state: present
|
||||
disable_gpg_check: yes
|
||||
notify:
|
||||
- test mail
|
||||
- restart msmtpd
|
||||
- name: Copy systemd unit file to server
|
||||
copy:
|
||||
src: msmtpd.service
|
||||
dest: /usr/lib/systemd/system/msmtpd.service
|
||||
mode: 0444
|
||||
when: ansible_os_family == "RedHat"
|
||||
|
||||
- name: Copy mstprc conf file.
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
---
|
||||
- name: Install msmtp
|
||||
yum:
|
||||
name:
|
||||
- "{{ msmtp_rpm_file }}"
|
||||
- mailx
|
||||
state: present
|
||||
disable_gpg_check: yes
|
||||
notify:
|
||||
- test mail
|
||||
- restart msmtpd
|
||||
when: ansible_os_family == "RedHat"
|
|
@ -0,0 +1,17 @@
|
|||
---
|
||||
- name: Fix msmtpd SELinux type context for msmtpd as a service
|
||||
community.general.sefcontext:
|
||||
target: '/usr/bin/msmtpd'
|
||||
setype: bin_t
|
||||
state: present
|
||||
|
||||
- name: Install msmtp
|
||||
yum:
|
||||
name:
|
||||
- msmtp
|
||||
- s-nail
|
||||
state: present
|
||||
notify:
|
||||
- test mail
|
||||
- restart msmtpd
|
||||
when: ansible_os_family == "RedHat"
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
# Default settings that all others accounts inherit
|
||||
defaults
|
||||
auth on
|
||||
tls on
|
||||
tls_starttls on
|
||||
auth {{msmtp_auth}}
|
||||
tls {{msmtp_tls}}
|
||||
tls_starttls {{msmtp_tls_starttls}}
|
||||
{% if msmtp_tls_trust_file is defined %}
|
||||
tls_trust_file {{msmtp_tls_trust_file}}
|
||||
{% else %}
|
||||
|
|
Loading…
Reference in New Issue