---
# Docker Routines
- name: "include docker-compose role"
  include_role: 
    name: docker-compose

- name: "Create {{ host_sphinx_source_dir_absolute }} directory"
  file:
    path: "{{ host_sphinx_source_dir_absolute }}"
    state: directory
    mode: '0755'

- name: "pull the source repository to build the Sphinx documentation from {{ applications.sphinx.repository_sphinx_source }} to {{ host_sphinx_source_dir_absolute }}"
  git:
    repo: "{{ applications.sphinx.repository_sphinx_source }}"
    dest: "{{ host_sphinx_source_dir_absolute }}"
    update: yes
    clone: yes
  notify: docker compose project build and setup 
  become: true

- name: "include role nginx-domain-setup for {{application_id}}"
  include_role:
    name: nginx-domain-setup
  vars:
    domain: 	"{{ domains[application_id] }}"
    http_port: 	"{{ ports.localhost.http[application_id] }}"

- name: "create {{ sphinx_host_dockerfile }}"
  copy:
    src:  "{{ sphinx_control_node_dockerfile }}"
    dest: "{{ sphinx_host_dockerfile }}"
    mode: '770'
    force: yes
  notify: docker compose project build and setup

- name: "copy docker-compose.yml and env file"
  include_tasks: copy-docker-compose-and-env.yml