- name: common-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: common-base-pkg
  apt:
    state: present
    name: [ certbot, tor, sudo ]
    update_cache: yes

# TODO: configurable contact email from config.yml
- name: common-certbot-setup
  copy:
    src: ../files/letsencrypt_cli.ini
    dest: /etc/letsencrypt/cli.ini

- include: tor.yml

- name: common-users-gen
  include_tasks: users/main.yml
  when: users is defined

- name: common-peering
  include: peering/main.yml
  when: peers is defined

- name: common-additional-packages
  include_tasks: packages.yml
  when: packages is defined

- name: common-roles
  include_role:
    name: "{{ current_role }}"
  loop: "{{ roles }}"
  loop_control:
    loop_var: current_role
  when: roles is defined
