summaryrefslogtreecommitdiffstats
path: root/roles/base/tasks/main.yml
blob: 8d2280b6cbbb4d87f99b9d54fbd13fda0568032b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
---
# User & Group Creation
- name: create groups
  group:
    name: "{{ item.value.group }}"
    state: "{{ item.value.state }}"
  loop: "{{ init_users | dict2items }}"

- name: create users
  user:
    name: "{{ item.value.name }}"
    group: "{{ item.value.group }}"
    groups: "{{ item.value.groups }}"
    create_home: "{{ item.value.create_home }}"
    state: "{{ item.value.state }}"
    shell: "{{ item.value.shell }}"
  loop: "{{ init_users | dict2items }}"

# SSH Initial Setup
- name: create .ssh dirs
  file:
    path: "/home/{{ item.value.name }}/.ssh"
    state: directory
    mode: 0700
    owner: "{{ item.value.name }}"
    group: "{{ item.value.group }}"
  loop: "{{ init_users | dict2items }}"


- name: Copy keys to users
  authorized_key:
    user: "{{ item.value.name }}"
    state: present
    key: "{{ lookup('file', 'keys/{{ item.value.name }}') }}"
  loop: "{{ init_users | dict2items }}"


- name: Copy custom sshd_config
  copy:
    src: sshd_config
    dest: "/etc/ssh/sshd_config.d/emacsconf_ssh.conf"
    mode: 0644
    owner: root
    group: root

# Sudoers
- name: sudoers.d entries
  copy:
    src: "sudoers.d/"
    dest: "/etc/sudoers.d/"
    mode: 0440
    owner: root
    group: root
    force: no