Add some docker util scripts
This commit is contained in:
parent
035ff0ac24
commit
7f1be920d6
5 changed files with 49 additions and 0 deletions
13
ansible/roles/docker/files/docker-utils/hard-reset-all.sh
Executable file
13
ansible/roles/docker/files/docker-utils/hard-reset-all.sh
Executable file
|
@ -0,0 +1,13 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
for compose_file in /opt/**/docker-compose.yml; do
|
||||
if [[ $(docker-compose -f $compose_file ps -q) ]]; then
|
||||
docker-compose -f $compose_file down --remove-orphans
|
||||
docker-compose -f $compose_file up -d
|
||||
else
|
||||
echo "> Skipping $compose_file as it's not running."
|
||||
fi
|
||||
|
||||
done
|
7
ansible/roles/docker/files/docker-utils/pull-all.sh
Executable file
7
ansible/roles/docker/files/docker-utils/pull-all.sh
Executable file
|
@ -0,0 +1,7 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
for compose_file in /opt/**/docker-compose.yml; do
|
||||
docker-compose -f $compose_file pull --parallel
|
||||
done
|
11
ansible/roles/docker/files/docker-utils/start-all.sh
Executable file
11
ansible/roles/docker/files/docker-utils/start-all.sh
Executable file
|
@ -0,0 +1,11 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
for compose_file in /opt/**/docker-compose.yml; do
|
||||
if [[ ! $(docker-compose -f $compose_file ps -q) ]]; then
|
||||
docker-compose -f $compose_file up -d
|
||||
else
|
||||
echo "> Skipping $compose_file as it's running."
|
||||
fi
|
||||
done
|
11
ansible/roles/docker/files/docker-utils/stop-all.sh
Executable file
11
ansible/roles/docker/files/docker-utils/stop-all.sh
Executable file
|
@ -0,0 +1,11 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
for compose_file in /opt/**/docker-compose.yml; do
|
||||
if [[ $(docker-compose -f $compose_file ps -q) ]]; then
|
||||
docker-compose -f $compose_file down --remove-orphans
|
||||
else
|
||||
echo "> Skipping $compose_file as it's not running."
|
||||
fi
|
||||
done
|
|
@ -35,3 +35,10 @@
|
|||
name: clean up docker containers
|
||||
special_time: weekly
|
||||
job: "docker system prune"
|
||||
|
||||
- name: Install util scripts
|
||||
copy:
|
||||
src: ./files/docker-utils
|
||||
dest: "{{ home }}"
|
||||
mode: 0755
|
||||
directory_mode: 0755
|
||||
|
|
Loading…
Reference in a new issue