aboutsummaryrefslogtreecommitdiff
path: root/infrastructure/roles/users/tasks/main.yaml
blob: 37d616c36374de7d9b4bdab7227cd7c5b31f44e2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
- name: create user
  ansible.builtin.user:
    name: "{{ item.name }}"
    shell: "{{ item.shell }}"
    groups:
      - sudo
  loop: "{{ users }}"
- name: create .ssh directory
  ansible.builtin.file:
    path: "/home/{{ item.name }}/.ssh"
    state: directory
    owner: "{{ item.name }}"
    group: "{{ item.name }}"
  loop: "{{ users }}"
- name: set authorized keys
  ansible.builtin.copy:
    dest: "/home/{{ item.name }}/.ssh/authorized_keys"
    owner: "{{ item.name }}"
    group: "{{ item.name }}"
    mode: '0400'
    content: "{{ item.authorized_keys }}"
  loop: "{{ users }}"