- name: "load variables from {{ role_path }}/vars/docker-compose.yml for whole play"
  include_vars: "{{ role_path }}/vars/docker-compose.yml"

- name: "remove {{ docker_compose.directories.instance }} and all its contents"
  file:
    path: "{{ docker_compose.directories.instance }}"
    state: absent
  when: mode_reset | bool

# This could lead to problems in docker-compose directories which are based on a git repository
# @todo Verify that this isn't the case. E.g. in accounting
- name: "Create all docker-compose directories (including parent directories)"
  file:
    path: "{{ item.value }}"
    state: directory
    mode: '0755'
  with_dict: "{{ docker_compose.directories }}"

- name: flush docker service
  meta: flush_handlers
  when: run_once_docker_compose is not defined

- name: run the docker tasks once
  set_fact:
    run_once_docker_compose: true
  when: run_once_docker_compose is not defined