Add deploy.sh
This commit is contained in:
parent
7a97d73ae0
commit
30b52f9fb9
|
@ -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
|
||||||
|
|
27
roles/apps/templates/scripts/deploy.sh.j2
Normal file
27
roles/apps/templates/scripts/deploy.sh.j2
Normal 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
|
Loading…
Reference in a new issue