---
- name: installation de jitsi
  apt:
    name: jitsi-meet

- name: Conf let's encrypt - désactivation de la demande du mail de supervision
  replace:
    path: /usr/share/jitsi-meet/scripts/install-letsencrypt-cert.sh
    regexp: "^read EMAIL"
    replace: |
      #read EMAIL
      EMAIL=supervision@nereide.fr

- name: Exécution du script lets encrypt
  shell:
    cmd: /usr/share/jitsi-meet/scripts/install-letsencrypt-cert.sh >> jitsi-le.log
    creates: /etc/letsencrypt/live/{{ inventory_hostname }}/fullchain.pem  # Execute le script que si ce fichier n'existe pas

- name: Ajout d'un memo pour suprimer manuellement Jitsi
  copy:
    dest: /root/purgeJitsi.sh
    mode: 0700
    content: |
      systemctl stop jitsi-videobridge2 prosody jicofo nginx coturn
      apt purge jitsi-meet && apt --purge autoremove
      rm -rf /etc/jitsi/ /usr/share/jitsi-* /etc/letsencrypt
