Import the old “create-users” group
[noc.git] / ansible / roles / create-users / tasks / main.yml
1 - name: Install sudo
2   apt:
3     name: sudo
4     state: present
5   when: sudo in aux_groups
6
7 - name: Create users
8   become: True
9   user:
10     name:     "{{ item }}"
11     shell:    "{{ users[item].shell }}"
12     groups:   "{{ aux_groups }}"
13   with_items: "{{ user_groups[group] }}"
14
15 - name: Set SSH keys for users
16   become: True
17   authorized_key:
18     user: "{{ item }}"
19     key:  "{{ users[item].ssh | join("\n") }}"
20   with_items: "{{ user_groups[group] }}"
21
22 # TODO:
23 # - on user creation, generate a password and send it, along with useful info
24 #   (hostname, IP, SSH host key, ...), by encrypted email;
25 # - execute user-specific playbooks for deploying dotfiles?