-
Notifications
You must be signed in to change notification settings - Fork 9
/
setup.yml
252 lines (215 loc) · 6.23 KB
/
setup.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
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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
---
- hosts: localhost
connection: local
vars:
kernels: [linux-lts, linux] # first is default
default_kernel_params: 'cgroup_no_v1=all audit=0 swiotlb=4096'
extra_kernel_params: ''
boot_mode: uefi
root_on_ssd: true
uses_hdd: false
remote_server: false
compile_server: false
desktop: false
cdown: true
game_server: false
xorg: false
xorg_profile: ""
server: true
lowmem: false
thinkpad: false
steam: false
vulkan_drivers: []
arch: x86
pacman_arch: auto
cpu_microcode: intel-ucode
carch: x86_64
chost: x86_64-pc-linux-gnu
extra_cflags: ""
force_dhcpcd: false
wireguard_users:
# final_octet explicitly specified to avoid changing IPs if the list
# changes. 1 is reserved for the server.
- name: cdown
final_octet: 2
- name: cdown-phone
final_octet: 3
- name: lin-phone
final_octet: 5
- name: yj
final_octet: 200
- name: yj2
final_octet: 201
force_ssh: false
# WSL doesn't run with systemd. Genie may be possible for later, but for
# now just omit it.
systemd_init: true
lang_env: true
python_3_version: 3.11.4
node_version: 20.5.0
ruby_version: 3.2.2
perl_version: 5.38.0
users:
- cdown
quirks: []
features: []
vars_files:
- "vars/{{ lookup('env', 'AS_CONFIG') }}.yml"
tasks:
- include_vars: vars/vault.yml
# Conditional facts (not overrideable in vars)
- set_fact:
hdd_scheduler: bfq
ssd_scheduler: none
when: not server
- set_fact:
hdd_scheduler: mq-deadline
ssd_scheduler: none
when: server
# Populate facts
- service_facts:
# Base (crit): things that cannot be altered by quirks
- include_tasks: tasks/base/locale.yml
- include_tasks: tasks/base/systemd.yml
when: systemd_init
- include_tasks: tasks/base/pacman.yml
- include_tasks: tasks/base/users.yml
- include_tasks: tasks/base/sudo.yml
- include_tasks: tasks/base/packages.yml
# Quirks (machine-specific workarounds)
- include_tasks: tasks/quirks/{{ item }}.yml
with_items: "{{ quirks }}"
# Base: things wanted no matter what config is used
- include_tasks: tasks/base/sysctl.yml
- include_tasks: tasks/base/aur.yml
# Must go before kernel, because we need fsck.<filesystem> for
# mkinitcpio -P to pass
- include_tasks: tasks/base/filesystem.yml
- include_tasks: tasks/base/kernel.yml
when: boot_mode # if boot_mode is null, it's WSL or similar
- include_tasks: tasks/base/core.yml
- include_tasks: tasks/base/dotfiles.yml
with_items: '{{ users }}'
loop_control:
loop_var: user
- include_tasks: tasks/base/ssh.yml
when: systemd_init
- include_tasks: tasks/base/zswap.yml
when: systemd_init
- include_tasks: tasks/base/timers-pre.yml
when: systemd_init
- include_tasks: tasks/base/timers.yml
with_items:
- cache-updates
- hwclock-systohc
- pacman-fy
- vacuum-journals
when: systemd_init
- include_tasks: tasks/base/timers-remove.yml
with_items:
- clean-cache
- keep-disk-on
when: systemd_init
- include_tasks: tasks/base/remove.yml
# Boot
- include_tasks: tasks/boot/{{ boot_mode }}.yml
when: boot_mode != None
# Remote only
- include_tasks: tasks/server/{{ item }}.yml
with_items:
- nginx
- munin
- atop
when: server
# Local only
- include_tasks: tasks/local_server/{{ item }}.yml
with_items:
- packages
- scratch
when: not remote_server and server
# Compile server only
- include_tasks: tasks/compile_server/{{ item }}.yml
with_items:
- packages
- systemd
- linux
when: compile_server
# Desktop only
- include_tasks: tasks/desktop/{{ item }}.yml
with_items:
- packages
- sound
- webcam
- fonts
when: desktop
- include_tasks: tasks/desktop/{{ item }}.yml
with_items:
- cfs
- printscan
- ufw
when: desktop and systemd_init # otherwise it's wsl or similar, so no need
- include_tasks: tasks/desktop/{{ item }}.yml
with_items:
- xorg
when: desktop and xorg
- include_tasks: tasks/desktop/xorg-profiles/{{ xorg_profile }}.yml
when: 'desktop and xorg and xorg_profile != ""'
- include_tasks: tasks/desktop/{{ item }}.yml
with_items:
- cdown-packages
when: desktop and cdown
- include_tasks: tasks/desktop/{{ item }}.yml
with_items:
- steam
when: desktop and steam
# Langenv only
- include_tasks: tasks/env/rustup.yml
with_items: '{{ users }}'
loop_control:
loop_var: user
when: lang_env
- include_tasks: tasks/env/rbenv.yml
with_items: '{{ users }}'
loop_control:
loop_var: user
when: lang_env
- include_tasks: tasks/env/pyenv.yml
with_items: '{{ users }}'
loop_control:
loop_var: user
when: lang_env
- include_tasks: tasks/env/nodenv.yml
with_items: '{{ users }}'
loop_control:
loop_var: user
when: lang_env
- include_tasks: tasks/env/plenv.yml
with_items: '{{ users }}'
loop_control:
loop_var: user
when: lang_env
- include_tasks: tasks/env/lowmem.yml
when: not lang_env and lowmem
# Game server only
- include_tasks: tasks/game_server/{{ item }}.yml
with_items:
- l4d2
when: game_server
# Features (one-off, small features with little impact on the system)
- include_tasks: tasks/features/{{ item }}.yml
with_items: "{{ features }}"
# Currently unused: seedbox/
handlers:
- name: restart sshd
service: name=sshd state=restarted
- name: restart nginx
service: name=nginx state=restarted
- name: restart unbound
service: name=unbound state=restarted
- name: restart munin-node
service: name=munin-node state=restarted
- name: restart geoip-http
service: name=geoip-http state=restarted
- name: reload geoip
uri:
url: "http://localhost:3000/db/reload"