-
Notifications
You must be signed in to change notification settings - Fork 497
/
setup_lab_user.yml
60 lines (51 loc) · 1.41 KB
/
setup_lab_user.yml
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
55
56
57
58
59
60
---
- name: Create lab-user
user:
name: "{{ lab_user }}"
group: "users"
state: present
- name: Enable sudoers
lineinfile:
path: '/etc/sudoers'
state: present
line: "{{ lab_user }} ALL=(ALL) NOPASSWD: ALL"
insertafter: 'EOF'
- when: setup_lab_materials | default(false) | bool
name: Create lab_materials dir
file:
dest: /home/{{ lab_user }}/lab_materials
mode: 0755
owner: "{{ lab_user }}"
group: "users"
state: directory
- name: lab_user ssh setup
block:
- name: create /home/{{ lab_user }}/.ssh
file:
dest: /home/{{ lab_user }}/.ssh
mode: 0700
owner: "{{ lab_user }}"
group: "users"
state: directory
- name: copy the environment .pem key
copy:
src: "{{ output_dir }}/{{ env_authorized_key }}"
dest: "/home/{{ lab_user }}/.ssh/{{env_authorized_key}}.pem"
owner: "{{ lab_user }}"
group: "users"
mode: 0400
- name: copy the environment .pub key
copy:
src: "{{ output_dir }}/{{ env_authorized_key }}.pub"
dest: "/home/{{ lab_user }}/.ssh/{{env_authorized_key}}.pub"
owner: "{{ lab_user }}"
group: "users"
mode: 0400
- name: copy .ssh/config template
template:
src: ./files/ssh_config.j2
dest: /home/{{ lab_user }}/.ssh/config
owner: "{{ lab_user }}"
group: "users"
mode: 0400
...