lab-ansible/roles/proxy/templates/scripts/deploy.sh.j2

29 lines
678 B
Django/Jinja

{# code: language=ansible-jinja #}
# THIS FILE IS MANAGED BY ANSIBLE
#!/usr/bin/env bash
ARG="$1"
PROXY_DIR="{{ proxy_data_root }}"
case $ARG in
start)
docker compose -f $PROXY_DIR/docker-compose.yml up --remove-orphans -d
;;
stop)
docker compose -f $PROXY_DIR/docker-compose.yml down --remove-orphans
;;
restart)
docker compose -f $PROXY_DIR/docker-compose.yml restart
;;
reload-proxy)
CADDYFILE="/etc/caddy/Caddyfile"
docker compose -f $PROXY_DIR/docker-compose.yml exec caddy \
sh -c "caddy validate -c $CADDYFILE && caddy reload -c $CADDYFILE" \
2>/dev/null
;;
*)
echo "Unrecognized argument"
exit 1
;;
esac