mariadb.yml aktualisiert

This commit is contained in:
olli 2024-05-28 13:39:58 +02:00
parent 0973a32533
commit dbf60e2555

View File

@ -60,14 +60,18 @@
marker: "# {mark} ANSIBLE MANAGED BLOCK" marker: "# {mark} ANSIBLE MANAGED BLOCK"
block: | block: |
cd /home/docker/mariadb.{{inventory_hostname}} cd /home/docker/mariadb.{{inventory_hostname}}
# start phpmyadmin (if not) to force traefik to get a letsencrypt certificate
docker compose up -d mariadb.{{inventory_hostname}}--phpmyadmin docker compose up -d mariadb.{{inventory_hostname}}--phpmyadmin
mkdir -p ssl mkdir -p ssl
# take letsencrypt-certs from traefik and check for new ones # take letsencrypt-certs from traefik and check for new ones
new=0 new=0
for ssl in key certificate for ssl in key certificate
do do
touch ssl/${ssl}.pem touch ssl/${ssl}.pem
[ -d ssl/${ssl}.pem ] && rm -r ssl/${ssl}.pem [ -d ssl/${ssl}.pem ] && rm -r ssl/${ssl}.pem
until [ -s "ssl/${ssl}.pem.new" ] until [ -s "ssl/${ssl}.pem.new" ]
do do
cat /home/docker/traefik/letsencrypt/acme.json | jq -r ".letsencrypt.Certificates[] | select(.domain.main==\"mariadb.{{inventory_hostname}}\") | .${ssl}" | base64 -d >ssl/${ssl}.pem.new cat /home/docker/traefik/letsencrypt/acme.json | jq -r ".letsencrypt.Certificates[] | select(.domain.main==\"mariadb.{{inventory_hostname}}\") | .${ssl}" | base64 -d >ssl/${ssl}.pem.new
@ -89,6 +93,10 @@
if [ -n "$new" ] if [ -n "$new" ]
then then
until [ -s "db-data/mysql_upgrade_info" ]
do
sleep 5
done
docker compose down docker compose down
docker compose up -d docker compose up -d
fi fi