2020-05-31 10:17:10 +00:00
|
|
|
---
|
|
|
|
- name: setup user account
|
|
|
|
user:
|
|
|
|
name: "{{ username }}"
|
|
|
|
password: "{{ password }}"
|
|
|
|
create_home: yes
|
|
|
|
state: present
|
|
|
|
update_password: always
|
2020-11-11 14:23:14 +00:00
|
|
|
groups: sudo
|
2020-05-31 10:17:10 +00:00
|
|
|
register: account
|
2020-11-11 13:39:50 +00:00
|
|
|
|
|
|
|
- name: ensure .ssh exists
|
|
|
|
become_user: "{{ account.name }}"
|
|
|
|
file:
|
|
|
|
path: "/home/{{ account.name }}/.ssh"
|
|
|
|
state: directory
|
|
|
|
mode: "0700"
|
|
|
|
|
|
|
|
- name: copy ssh key
|
|
|
|
become_user: "{{ account.name }}"
|
|
|
|
copy:
|
|
|
|
src: "{{ item }}"
|
|
|
|
dest: "/home/{{ account.name }}/.ssh/"
|
|
|
|
mode: "0600"
|
|
|
|
with_fileglob:
|
|
|
|
- "/mnt/c/Users/mandl/.ssh/id_rsa*"
|