ansible-machine-setup/roles/user-account/tasks/main.yaml

38 lines
816 B
YAML

---
- name: setup user account
user:
name: "{{ username }}"
password: "{{ password }}"
create_home: yes
state: present
update_password: always
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: "ssh/"
dest: "/home/{{ account.name }}/.ssh/"
mode: "0600"
- name: ensure .gnupg exists
become_user: "{{ account.name }}"
file:
path: "/home/{{ account.name }}/.gnupg"
state: directory
mode: "0700"
- name: copy gpg keys
become_user: "{{ account.name }}"
copy:
src: "gnupg/"
dest: "/home/{{ account.name }}/.gnupg/"
mode: "0600"