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

29 lines
678 B
Plaintext
Raw Normal View History

2024-02-04 17:03:15 +00:00
{# code: language=ansible-jinja #}
# THIS FILE IS MANAGED BY ANSIBLE
#!/usr/bin/env bash
2023-11-13 20:17:17 +00:00
ARG="$1"
2023-12-22 20:57:19 +00:00
PROXY_DIR="{{ proxy_data_root }}"
2023-11-13 20:17:17 +00:00
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
;;
2023-12-31 17:20:28 +00:00
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
;;
2023-11-13 20:17:17 +00:00
*)
echo "Unrecognized argument"
exit 1
;;
esac