- name: Activer les backports
  lineinfile:
    path: /etc/apt/sources.list.d/backports.list
    line: deb http://ftp.debian.org/debian buster-backports main contrib
    create: yes
    state: present

- name: Installer les paquets de base
  apt:
    state: present
    name: [ certbot, tor, sudo ]
    update_cache: yes

- name: Installer les paquets définis dans la config
  apt:
    state: present
    name: "{{ packages.debian }}"
  when: packages is defined and packages.debian is defined

- name: setup certbot with contact email
  copy:
    src: ../files/letsencrypt_cli.ini
    dest: /etc/letsencrypt/cli.ini

- include: tor.yml

- include: users.yml

- name: Exécuter les rôles définis dans la config
  include_role:
    name: "{{ current_role }}"
  loop: "{{ roles }}"
  loop_control:
    loop_var: current_role
  when: roles is defined
