blob: f6bfe6e026c11ed09cf2ec78c245b73d72f022d9 (
plain)
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
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
|
# Ansible playbook to install stuff for v-i.
- hosts: image
tasks:
# This is a workaround for the fact the the chroot vmdb2 creates
# lacks an /etc/resolv.conf.
- name: "install a temporary /etc/resolv.conf"
copy:
content:
nameserver 8.8.8.8
dest: /etc/resolv.conf
- name: "check /etc/resolv.conf and DNS lookup work"
shell: |
cat /etc/resolv.conf || true
ping -c1 pieni.net
# General configuration of installer system.
- name: "install file with version info of installer"
copy:
content: |
{{ lookup('pipe', 'git describe --dirty') }}
dest: /etc/v-i-version
- name: "set hostname in /etc/hostname"
shell: |
echo "{{ hostname }}" > /etc/hostname
- name: "unset root password so that virtual console logins work"
shell: |
sed -i '/^root:[^:]*:/s//root::/' /etc/passwd /etc/shadow
- name: "remove ping so it can be re-installed for the right capabilities"
apt:
name: iputils-ping
state: absent
- name: "re-install ping"
apt:
name: iputils-ping
state: present
- name: "uninstall rsyslogd to avoid writing logs to slow disk"
apt:
name: rsyslogd
state: absent
purge: yes
- name: "make systemd journal non-persistent, to avoid writing logs to slow disk"
lineinfile:
path: /etc/systemd/journald.conf
regexp: Storage=
line: Storage=volatile
- name: "enable v-i-config service"
shell: |
install -d /etc/systemd/system/ssh.service.wants
ln -nsf /etc/systemd/system/v-i-config.service /etc/systemd/system/ssh.service.wants/v-i-config.service
- name: "add non-free-firmware (and more) to apt sources, for wifi"
apt_repository:
repo: "deb http://deb.debian.org/debian bookworm contrib non-free non-free-firmware"
# Install vmdb2, which actually does the installation to the
# target system.
- name: "add APT key for CI repo with vmdb2"
copy:
content: "{{ ci_prod_signing_key }}"
dest: /etc/apt/trusted.gpg.d/ci_prod.asc
- name: "add CI repo with vmdb2 to apt sources"
apt_repository:
repo: "deb http://ci-prod-controller.vm.liw.fi/debian unstable-ci main"
- name: "install vmdb2"
apt:
name: vmdb2
# Locale specific configuration.
- name: "configure keyboard layout"
copy:
content: |
XKBMODEL="pc105"
XKBLAYOUT="us"
XKBVARIANT=""
XKBOPTIONS=""
BACKSPACE="guess"
dest: /etc/default/keyboard
- name: "configure console"
copy:
content: |
ACTIVE_CONSOLES="/dev/tty[1-6]"
CHARMAP="UTF-8"
CODESET="Lat15"
FONTFACE="Fixed"
FONTSIZE="8x16"
VIDEOMODE=
dest: /etc/default/console-setup
mode: 0644
- name: "set default LC_TYPE for all users"
shell:
echo export LC_CTYPE=fi_FI.UTF8 >> /etc/profile.d/finnish.sh
- name: "silence kernel messages to console"
copy:
content:
kernel.printk = 3 4 1 3
dest:
/etc/sysctl.d/kernel.conf
mode: 0644
# SSH configuration.
- name: "restrict root logins over ssh to require a key"
lineinfile:
path: /etc/ssh/sshd_config
regex: "#* *PasswordAuthentication"
line: "PasswordAuthentication no"
- name: "create /root/.ssh"
file:
state: directory
path: /root/.ssh
owner: root
group: root
mode: 0700
# Network configuration.
- name: "install wifi firmware and iwd"
apt:
name:
- firmware-brcm80211
- firmware-iwlwifi
- firmware-libertas
- firmware-misc-nonfree
- firmware-realtek
- firmware-ti-connectivity
- iwd
- name: "remove ifupdown in favor of systemd-networkd"
apt:
name: ifupdown
state: absent
- name: "enable systemd-networkd"
systemd:
name: systemd-networkd
enabled: true
- name: "configure eth0 to get an address using DHCP"
copy:
content: |
[Match]
Name=eth0
[Network]
DHCP=ipv4
[DHCPv4]
RouteMetric=20
UseDomains=true
dest: /etc/systemd/network/eth0.network
# Allow lookup of domain-less names, when the DHCP server doesn't
# set a domain for the LAN. See
# https://wiki.archlinux.org/title/Systemd-resolved#systemd-resolved_does_not_resolve_hostnames_without_suffix
- name: "tweak resolved.conf for domain-less DNS lookup"
lineinfile:
path: /etc/systemd/resolved.conf
regexp: ResolveUnicastSingleLabel=
line: ResolveUnicastSingleLabel=yes
- name: "configure bridge device br0 for local network ports"
copy:
content: |
[NetDev]
Name=br0
Kind=bridge
dest: /etc/systemd/network/br0.netdev
- name: "add local network ports to br0"
copy:
content: |
[Match]
Name=eth[^0]*
[Network]
Bridge=br0
dest: /etc/systemd/network/local.network
- name: "configure bridge br0"
copy:
content: |
[Match]
Name=br0
[Network]
Address={{ puomi_lan_ip }}/24
DHCPServer=false
IPForward=false
IPMasquerade=false
ConfigureWithoutCarrier=true
dest: /etc/systemd/network/br0.network
- name: "configure wifi"
copy:
content: |
[Match]
Name=wlan0
[Network]
DHCP=yes
[DHCPv4]
RouteMetric=20
dest: /etc/systemd/network/wireless.network
- name: "enable iwd"
systemd:
name: iwd
enabled: yes
- name: "install dnsmasq"
apt:
name: dnsmasq
- name: "configure dnsmasq for configuration .d directory support"
lineinfile:
path: /etc/dnsmasq.conf
regexp: ^conf-dir
line: "conf-dir=/etc/dnsmasq.d/,*.conf"
- name: "configure dnsmasq for local bridge br0"
copy:
content: |
dhcp-range={{ puomi_dhcp_start }},{{ puomi_dhcp_end }},{{ puomi_dhcp_netmask }},{{ puomi_dhcp_lease }}
host-record={{ hostname }},{{ puomi_lan_ip }}
interface=br0
interface=lo
max-cache-ttl=30
neg-ttl=10
dest: /etc/dnsmasq.d/router.conf
vars:
hostname: v-i
ansible_python_interpreter: /usr/bin/python3
ci_prod_signing_key: |
-----BEGIN PGP PUBLIC KEY BLOCK-----
mQINBFrLO7kBEADdz6mHstYmKU5Dp6OSjxWtWaqTDOX1sJdmmaIK/9EKVIH0Maxp
5kvVO5G6mULLAjv/kLG0MxasHPrq8I2A/y8AqKAGVL8QelwLjQMIFZ30/VbGQPHS
+T5TZXEnoQtNce1GUhFwJ38ZyjjwHBFV9tSec7rZ2Q3YeM3nNnGPf6DacXGfEOPO
HIN4sXAN2hzNXNjKRzTIvxQseb6nr7afUh/SlZ3yhQOCrIzmYlD7tP9WJe7ofL0p
JY4pDQYw8rT6nC2BE/ioemh84kERCT1vCe+OVFlSRuMlqfEv+ZpKQ+itOmPDQ/lM
jpUm1K2hrW/lWpxT/ZxHKo/w1K36J5WshgMZxfUu5BMCL9LMqMcrXNhNjDMfxDMM
3yBPOvQ4ls6fecOZ/bsFo1p8VzMk/w/eG8vPs5yuNa5XxN95yFMXoOHGb5Xbu8D4
6yiW+Af70LbiSNpGdmNdneiGB2fY38NxBukPw5u3S5qG8HedSmMr1RvSr5kHoAAe
UbOY+BYaaKsTAT7+1skUW1o3FJSqoRKCHAzTsMWC6zzhR8hRn7jVrrguH1hGbqq5
TZSCFQZExuTJ7uXrTLG0WoBXIjB5wWNcSeXn8myUWYB51nJNF4tJBouZOz9JwWGl
kiAQkrHnBttLQWdW9FyjbIoTZMtpvVx+m6ObGTGdGL1cNlLAvWprMXGc+QARAQAB
tDJJY2sgQVBUIHJlcG9zaXRvcnkgc2lnbmluZyBrZXkgKDIwMTgpIDxsaXdAbGl3
LmZpPokCTgQTAQgAOBYhBKL1uyDoXyxUH3O717Wr+TZVS6PGBQJayzu5AhsDBQsJ
CAcCBhUICQoLAgQWAgMBAh4BAheAAAoJELWr+TZVS6PGB5QQANTcikhRUHwt9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