deployment/roles/create-debian-user/tasks/main.yml

32 lines
592 B
YAML

---
- name: Install sudo.
apt:
name: sudo
state: present
- name: Create debian user.
user:
name: debian
groups: sudo
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'