Add deploy.sh

This commit is contained in:
Sam A. 2023-11-11 16:21:29 +01:00
parent 7a97d73ae0
commit 30b52f9fb9
Signed by: samsapti
GPG key ID: CBBBE7371E81C4EA
2 changed files with 34 additions and 0 deletions

View file

@ -30,3 +30,10 @@
app_name: "{{ item }}" app_name: "{{ item }}"
app_vars: "{{ apps_vars[item] }}" app_vars: "{{ apps_vars[item] }}"
loop: "{{ apps_include }}" loop: "{{ apps_include }}"
- name: Copy deploy.sh
ansible.builtin.template:
src: scripts/deploy.sh.j2
dest: /usr/local/bin/deploy.sh
owner: root
mode: u=rwx,g=rx,o=rx

View file

@ -0,0 +1,27 @@
#!/usr/bin/env bash
# code: language=bash
ARG="$1"
APPS_DIR="{{ apps_data_root }}"
case $ARG in
start)
for app in $APPS_DIR/*; do
docker compose -f $app/docker-compose.yml up --remove-orphans -d
done
;;
stop)
for app in $APPS_DIR/*; do
docker compose -f $app/docker-compose.yml down --remove-orphans
done
;;
restart)
for app in $APPS_DIR/*; do
docker compose -f $app/docker-compose.yml restart
done
;;
*)
echo "Unrecognized argument"
exit 1
;;
esac