Fix pre-commit hooks and move directories
roles/ and inventory/ are now in playbooks/ also fixed issues reported by ansible-lint
This commit is contained in:
parent
dc398ddb6e
commit
4104057771
123 changed files with 91 additions and 39 deletions
playbooks/roles/lego/files
6
playbooks/roles/lego/files/hook.sh
Normal file
6
playbooks/roles/lego/files/hook.sh
Normal file
|
@ -0,0 +1,6 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
cp -f "$LEGO_CERT_PATH" /certificates
|
||||
cp -f "$LEGO_CERT_KEY_PATH" /certificates
|
||||
|
||||
exit 33 # special exit code to signal that the certificate has been updated
|
12
playbooks/roles/lego/files/hooks/auth.serguzim.me
Executable file
12
playbooks/roles/lego/files/hooks/auth.serguzim.me
Executable file
|
@ -0,0 +1,12 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
domain="auth.serguzim.me"
|
||||
|
||||
_install() {
|
||||
install --owner=root --group=root --mode=600 \
|
||||
"$CERTIFICATES_PATH/$domain.$1" \
|
||||
"/opt/services/authentik/certs/$domain.$2"
|
||||
}
|
||||
|
||||
_install crt pem
|
||||
_install key key
|
16
playbooks/roles/lego/files/hooks/db.serguzim.me
Executable file
16
playbooks/roles/lego/files/hooks/db.serguzim.me
Executable file
|
@ -0,0 +1,16 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
domain="db.serguzim.me"
|
||||
|
||||
_install() {
|
||||
install --owner=postgres --group=postgres --mode=600 \
|
||||
"$CERTIFICATES_PATH/$domain.$1" \
|
||||
"/var/lib/postgres/data/server.$1"
|
||||
}
|
||||
|
||||
_install crt
|
||||
_install key
|
||||
|
||||
sudo -u postgres pg_ctl -D /var/lib/postgres/data/ reload
|
||||
|
||||
# vim: ft=sh
|
26
playbooks/roles/lego/files/lego.sh
Executable file
26
playbooks/roles/lego/files/lego.sh
Executable file
|
@ -0,0 +1,26 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
set -a
|
||||
. ./service.env
|
||||
set +a
|
||||
|
||||
domain="$1"
|
||||
action="run"
|
||||
|
||||
exisiting_domains=$(docker compose run --rm app list -n)
|
||||
|
||||
if echo "$exisiting_domains" | grep -q "$domain";
|
||||
then
|
||||
action="renew"
|
||||
fi
|
||||
|
||||
docker compose run --rm app \
|
||||
--domains "$domain" \
|
||||
"$action" \
|
||||
"--$action-hook" "/config/hook.sh"
|
||||
|
||||
if [ "$?" = "33" ] && [ -x "./hooks/$domain" ];
|
||||
then
|
||||
echo "Running hook for $domain"
|
||||
"./hooks/$domain"
|
||||
fi
|
10
playbooks/roles/lego/files/lego@.timer
Normal file
10
playbooks/roles/lego/files/lego@.timer
Normal file
|
@ -0,0 +1,10 @@
|
|||
[Unit]
|
||||
Description=Renew certificates
|
||||
|
||||
[Timer]
|
||||
Persistent=true
|
||||
OnCalendar=*-*-* 01:15:00
|
||||
RandomizedDelaySec=2h
|
||||
|
||||
[Install]
|
||||
WantedBy=timers.target
|
Loading…
Add table
Add a link
Reference in a new issue