-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path01-common.yml
More file actions
148 lines (133 loc) · 3.57 KB
/
01-common.yml
File metadata and controls
148 lines (133 loc) · 3.57 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
---
# tasks file for zero_footprint_qbittorrent_seedbox/01-common
- name: COMMON | 1.1 Upgrade all existing packages
ansible.builtin.dnf:
name: "*"
state: "latest" # noqa package-latest
notify:
- "Restart NetworkManager"
become: true
tags:
- common
- name: COMMON | 1.2 Flush handlers
ansible.builtin.meta: flush_handlers
tags:
- common
- name: COMMON | 1.3 Set timezone
community.general.timezone:
name: "{{ set_timezone }}"
become: true
tags:
- common
- name: COMMON | 1.4 Add two IPv4 Google DNS servers (Optional)
# Can be tricky sometimes, if multiple connections of the same
# type are present - e.g. `eth0` and `System eth0`. Manual
# check is required to see if it was applied to the correct one!
community.general.nmcli:
conn_name: "{{ ansible_default_ipv4.alias }}"
type: "ethernet"
dns4:
- 8.8.8.8
- 8.8.4.4
state: "present"
become: true
when: set_google_dns
tags:
- common
- name: COMMON | 1.5 Create a directory structure
ansible.builtin.file:
path: "/home/{{ ansible_user }}/{{ item }}"
state: "directory"
mode: "0777"
loop: "{{ create_folders }}"
tags:
- common
- name: COMMON | 1.6 Remove unnecessary messages of the day
ansible.builtin.file:
path: "/etc/motd.d/{{ item }}"
state: "absent"
become: true
loop:
- "cockpit"
- "insights-client"
tags:
- common
- name: COMMON | 1.7 Systemd wide DefaultLimitNOFILE
ansible.builtin.lineinfile:
path: "{{ systemd_cfg_path }}"
regexp: '^#DefaultLimitNOFILE=.*'
line: "DefaultLimitNOFILE={{ maximum_number_of_open_file_descriptors }}"
backup: true
become: true
tags:
- common
- name: COMMON | 1.8 Set soft nofile limit
ansible.builtin.lineinfile:
path: "{{ systemd_limits_path }}"
line: "* soft nofile \
{{ maximum_number_of_open_file_descriptors }}"
insertbefore: '^# End of file$'
backup: true
become: true
tags:
- common
- name: COMMON | 1.9 Set hard nofile limit
ansible.builtin.lineinfile:
path: "{{ systemd_limits_path }}"
line: "* hard nofile \
{{ maximum_number_of_open_file_descriptors }}"
insertbefore: '^# End of file$'
backup: true
become: true
tags:
- common
- name: COMMON | 1.10 Get /home mount information
ansible.builtin.set_fact:
home_mount: "{{ ansible_mounts | selectattr('mount', 'equalto', '/home')
| list | first }}"
tags:
- common
- name: COMMON | 1.11 Remount a /home and change atime options
ansible.posix.mount:
src: "UUID={{ home_mount.uuid }}"
path: "/home"
fstype: "{{ home_mount.fstype }}"
state: "present"
opts: "defaults,noatime,nodiratime"
backup: true
become: true
tags:
- common
- name: COMMON | 1.12 Include sysctl vars
ansible.builtin.include_vars: "vars/sysctl.yml"
when: sysctl_tunables
tags:
- common
- name: COMMON | 1.13 Set various sysctl settings
ansible.posix.sysctl:
name: "{{ item.key }}"
value: "{{ item.value }}"
sysctl_set: true
reload: true
state: present
loop: "{{ sysctl_settings | dict2items }}"
become: true
when: sysctl_tunables
tags:
- common
- name: COMMON | 1.14 Install dynamic adaptive system tuning daemon
ansible.builtin.dnf:
name: "tuned"
state: present
become: true
tags:
- common
- name: COMMON | 1.15 Configure tuned for high throughput
ansible.builtin.command: "tuned-adm profile {{ tuned_profile }}"
register: tuned_profile_result
changed_when: tuned_profile_result.rc == 0
notify:
- "Restart tuned"
become: true
tags:
- common