19 lines
741 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
failed_when: >
docker_ps.rc != 0
and
'no configuration file provided: not found' not in (docker_ps.stderr | default(''))
when: >
not (
docker_compose_template.changed | default(false)
or
env_template.changed | default(false)
)
notify: docker compose up