---
- name: Install sudo.
  apt:
    name: sudo
    state: present

- name: Create data group.
  group:
    name: data
    gid: 1002

- name: Create debian user.
  user:
    name: debian
    groups:
      - sudo
      - data
    append: true
    create_home: yes
    shell: /bin/bash
    password: "{{ debian_pass | password_hash('sha512') }}"
    update_password: on_create

- name: Create SSH directory.
  file:
    path: /home/debian/.ssh/
    state: directory
    owner: debian
    group: debian
    mode: '700'

- name: Add authorized SSH keys.
  copy:
    src: authorized_keys
    dest: /home/debian/.ssh/authorized_keys
    owner: debian
    group: debian
    mode: '600'
