---
- hosts: WHAT_HOST_IN_USE

  tasks:
    - name: Creates directory DESTINATION_FOLDER
      ansible.builtin.file:
        path: DESTINATION_FOLDER
        state: directory
        mode: 0775
        recurse: yes

    - name: Set up docker-compose file
      template:
        src: "WHAT_PART_LOCAL/docker-compose.yml"
        dest: "DESTINATION_FOLDER"

    - name: docker compose up
      shell:
        chdir: "DESTINATION_FOLDER/"
        cmd: docker-compose up -d

    - name: docker exec create log folder
      shell:
        cmd: docker exec -it DESTINATION_FOLDER  mkdir -p /var/www/html/writable/logs

    - name: docker exec create cache folder
      shell:
        cmd: docker exec -it DESTINATION_FOLDER  mkdir -p /var/www/html/writable/cache

    - name: docker exec permission log folder
      shell:
        cmd: docker exec -it DESTINATION_FOLDER  chmod 0777 /var/www/html/writable/logs

    - name: docker exec permission cache folder
      shell:
        cmd: docker exec -it DESTINATION_FOLDER  chmod 0777 /var/www/html/writable/cache