---
# tasks file for deploy_all

- name: "Check for secrets volume. Fail if not found"
  include: "{{ item }}"
  with_first_found:
    - files:
      - secrets/mounted


- name: sync services dirs
  ansible.posix.synchronize:
    src: ../services/
    dest: /docker/
    delete: true
    archive: false
    recursive: true
    copy_links: true # This allows some bidouillage on the server


- name: Add binaries
  ansible.posix.synchronize:
    src: "{{ role_path }}/files/bin/"
    dest: "/usr/local/bin"

- name: Gen env vars
  command: gen_env.sh

- name: sync secrets
  ansible.posix.synchronize:
    src: secrets/
    dest: /data/secrets
    delete: true
    archive: false
    recursive: true
    copy_links: true # This allows some bidouillage on the server

    #- name: Add bind conf
    #  ansible.posix.synchronize:
    #    src: "{{ role_path }}/files/bind/"
    #    dest: "/etc/bind/"
    #
    #- name: make sure bind9 is started
    #  ansible.builtin.service:
    #    name: bind9
    #    state: started
    #- name: Reload service bind9, in all cases
    #  ansible.builtin.service:
    #    name: bind9
    #    state: reloaded

    #- name: Start the deployer
    #  ansible.builtin.command:
    #    command: /docker/_deployer/main.sh