This repository has been archived on 2024-12-15. You can view files and clone it, but cannot push or open issues or pull requests.
ansible-machine-setup/roles/user-account/tasks/main.yaml
2020-11-13 08:37:33 +01:00

27 lines
584 B
YAML

---
- name: setup user account
user:
name: "{{ username }}"
password: "{{ password }}"
create_home: yes
state: present
update_password: always
groups: sudo
register: account
- 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*"