- name: Register users
  user:
    name: "{{ item.name }}"
    state: present
    skeleton: /etc/skel
    shell: /bin/bash
    system: no
    createhome: yes
    home: "/home/{{ item.name }}"

- name: Make admins sudo
  user:
    name: "{{ item.name }}"
    group: sudo
  when: item.sudo|default(false) == true

- name: Publish SSH keys
  authorized_key:
    user: "{{ item.name }}"
    state: present
    key: "{{ item.key }}"

- name: Génerer un onion pour l'utilisateurice
  template:
    src: ../files/onion.conf.j2
    dest: "/etc/tor/onions/{{ item.name }}.conf"
