-
Notifications
You must be signed in to change notification settings - Fork 396
Expand file tree
/
Copy pathsetup.yaml
More file actions
58 lines (53 loc) · 1.42 KB
/
setup.yaml
File metadata and controls
58 lines (53 loc) · 1.42 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
54
55
56
57
58
- name: Server setup
hosts: "{{ host }}"
tasks:
# Install required packages
- name: Update apt and install required system packages
become: true
apt:
pkg:
- curl
- vim
- git
- ufw
- make
- gcc
state: latest
update_cache: true
vars:
ansible_ssh_user: "{{ admin_user }}"
# Allow SSH connections and deny by default
- name: UFW - Allow SSH connections
become: true
community.general.ufw:
rule: allow
name: OpenSSH
vars:
ansible_ssh_user: "{{ admin_user }}"
- name: UFW - Enable and deny by default
become: true
community.general.ufw:
state: enabled
default: deny
vars:
ansible_ssh_user: "{{ admin_user }}"
# Create basic directories
- name: Create basic directories if do not exist
ansible.builtin.file:
path: /home/{{ ansible_user }}/{{ item }}
state: directory
mode: '0755'
owner: '{{ ansible_user }}'
group: '{{ ansible_user }}'
loop:
- repos
- config
- services
- .keystores
- name: Enable linger for {{ ansible_user }}
become: true
command: sudo loginctl enable-linger {{ ansible_user }}
args:
creates: /var/lib/systemd/linger/{{ ansible_user }}
vars:
ansible_ssh_user: "{{ admin_user }}"