---
- name: Deploy {{ svc.name }}
  tags:
    - acme-dns
    - certificates
  block:
    - import_tasks: steps/create-service-directory.yml
    - import_tasks: steps/template-docker-compose.yml

    - name: Setting the service config path
      ansible.builtin.set_fact:
        config_path: "{{ (service_path, 'config') | path_join }}"

    - name: Create a service-config directory
      ansible.builtin.file:
        path: "{{ config_path }}"
        state: directory
        mode: "0700"

    - name: Template config
      ansible.builtin.template:
        src: config.cfg.j2
        dest: "{{ (config_path, 'config.cfg') | path_join }}"
        mode: "0600"

    - import_tasks: steps/template-site-config.yml
    - import_tasks: steps/start-service.yml