mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-08-29 23:08:06 +02:00
THE HUGE REFACTORING CALENDER WEEK 33; Optimized Matrix and during this updated variables, and implemented better reset and cleanup mode handling, also solved some initial setup bugs
This commit is contained in:
22
roles/docker-compose/tasks/05_ensure_up.yml
Normal file
22
roles/docker-compose/tasks/05_ensure_up.yml
Normal file
@@ -0,0 +1,22 @@
|
||||
- name: "Check if any container is running in {{ docker_compose.directories.instance }}"
|
||||
command: docker compose ps -q --filter status=running
|
||||
args:
|
||||
chdir: "{{ docker_compose.directories.instance }}"
|
||||
register: docker_ps
|
||||
changed_when: >
|
||||
(docker_ps.stdout | trim) == ""
|
||||
# The failed when catches the condition when an docker compose file will be dynamicly build after the file routine
|
||||
# Also if an .env file isn't present
|
||||
failed_when: >
|
||||
docker_ps.rc != 0
|
||||
and (
|
||||
(docker_ps.stderr | default(''))
|
||||
| regex_search('(no configuration file provided|no such file or directory|env file .* not found)') is none
|
||||
)
|
||||
when: >
|
||||
not (
|
||||
docker_compose_template.changed | default(false)
|
||||
or
|
||||
env_template.changed | default(false)
|
||||
)
|
||||
notify: docker compose up
|
Reference in New Issue
Block a user