forked from kchandan/bash-tutorials
-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathlab-setup.yml
More file actions
53 lines (43 loc) · 1.23 KB
/
lab-setup.yml
File metadata and controls
53 lines (43 loc) · 1.23 KB
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
---
- name: setup lab
hosts: all
remote_user: root
become: true
tasks:
- name: Add the user 'student' with a specific uid and a primary group of 'student'
ansible.builtin.user:
name: "{{ item }}"
password: "{{ item | password_hash('sha512') }}"
with_items:
- student
- admin
- name: Insert/Update "Match User" configuration block in /etc/ssh/sshd_config
blockinfile:
path: /etc/ssh/sshd_config
block: |
Match User student
PasswordAuthentication yes
Match all
Match User admin
PasswordAuthentication yes
Match all
- name: Restart sshd
shell: service sshd restart
- name: Set timezone to America/New_York
community.general.timezone:
name: America/New_York
- name: Add line
copy:
src: admin.sudo
dest: /etc/sudoers.d/admin
- name: Add swap file
shell: sudo dd if=/dev/zero of=/swapfile count=4096 bs=1MiB
- name: change permission
shell: chmod 600 /swapfile ; mkswap /swapfile; swapon /swapfile
- name: Ensure fstab uses nodev
mount:
name: swapfile
src: /swapfile
fstype: swap
opts: sw
state: present