- block:
  - include_tasks: 01_core.yml
  - include_tasks: utils/run_once.yml
  when: run_once_docker_compose is not defined

- name: "Load variables from {{ DOCKER_COMPOSE_VARIABLE_FILE }} for whole play"
  include_vars: "{{ DOCKER_COMPOSE_VARIABLE_FILE }}"

# 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) for '{{ application_id }}'"
  file:
    path: "{{ item.value }}"
    state: directory
    mode: '0755'
  with_dict: "{{ docker_compose.directories }}"

- name: "Include routines to set up a git repository based installation for '{{ application_id }}'."
  include_tasks: "03_repository.yml"
  when: docker_pull_git_repository | bool

- block:
  - name: "Include file management routines for '{{ application_id }}'."
    include_tasks: "04_files.yml"
  - name: "Ensure that {{ docker_compose.directories.instance }} is up"
    include_tasks: "05_ensure_up.yml"
  when: not docker_compose_skipp_file_creation | bool

- name: "flush docker compose for '{{ application_id }}'"
  meta: flush_handlers
  when: docker_compose_flush_handlers | bool
