mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-08-15 16:40:45 +02:00
23 lines
856 B
YAML
23 lines
856 B
YAML
- 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
|