12
|
1 from pyinfra import host
|
|
2 from pyinfra.facts.server import LinuxDistribution
|
|
3 from pyinfra.operations import apt, files, ssh
|
|
4
|
|
5 is_pi = host.get_fact(LinuxDistribution)['name'] in ['Debian', 'Raspbian GNU/Linux']
|
|
6 is_wifi_pi = host.name in ['frontdoor', 'living']
|
|
7
|
|
8 if not is_pi:
|
|
9 apt.key(keyserver='keyserver.ubuntu.com', keyid='8B48AD6246925553')
|
|
10
|
|
11 if is_pi:
|
|
12 apt.packages(packages=['mandb', 'apt-listchanges'], present=False)
|
|
13 files.template(src='templates/pi_sources.list.j2', dest='/etc/apt/sources.list', rel='bullseye')
|
|
14 # 'apt upgrade'?
|
|
15 apt.packages(update=True, packages=['dirmngr', 'gnupg2', 'apt-utils'])
|
|
16
|
|
17 apt.key(src='https://ftp-master.debian.org/keys/archive-key-8.asc')
|
|
18 apt.key(src='https://ftp-master.debian.org/keys/archive-key-8-security.asc')
|
|
19 apt.key(src='https://ftp-master.debian.org/keys/archive-key-9-security.asc')
|
13
|
20 apt.key(keyserver='keyserver.ubuntu.com', keyid='04EE7237B7D453EC')
|
|
21 apt.key(keyserver='keyserver.ubuntu.com', keyid='648ACFD622F3D138')
|
12
|
22
|
|
23 files.file(path='/etc/apt/sources.list.d/raspi.list', present=False)
|
|
24
|
|
25 if is_wifi_pi:
|
|
26 files.put(dest="/etc/network/interfaces.d/wlan0", src="files/pi_wlan0_powersave")
|
|
27 ssh.command(host.name, "iw wlan0 set power_save off")
|
|
28
|
|
29 files.template(src='templates/boot_config.txt.j2', dest='/boot/config.txt')
|
|
30
|
|
31 if not is_pi and host.name != 'prime':
|
|
32 apt.key(src='https://dl.google.com/linux/linux_signing_key.pub')
|
|
33 apt.repo(src='deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main')
|
|
34
|
|
35 apt.key(src='https://packages.microsoft.com/keys/microsoft.asc')
|
|
36 apt.repo(src="deb [arch=amd64,arm64,armhf] http://packages.microsoft.com/repos/code stable main")
|
|
37
|
|
38 apt.ppa(src="ppa:savoury1/blender")
|
|
39
|
|
40 apt.key(keyserver='keyserver.ubuntu.com', keyid='F24AEA9FB05498B7')
|
|
41 apt.repo(src="deb [arch=amd64,i386] https://repo.steampowered.com/steam/ stable steam")
|
|
42
|
|
43 apt.packages(packages=[
|
|
44 'build-essential',
|
|
45 # 'i2c-tools',
|
|
46 'rsync',
|
|
47 'dstat',
|
|
48 'ifstat',
|
24
|
49 'mosquitto-clients',
|
|
50 'ncdu',
|
12
|
51 ])
|
|
52
|
|
53 if not is_pi:
|
|
54 apt.packages(packages=[
|
|
55 'keychain',
|
|
56 'python3-docker',
|
|
57 'python3-invoke',
|
|
58 'python3-pip',
|
|
59 'python3-virtualenv',
|
|
60 'sysstat',
|
24
|
61 'debian-goodies',
|
12
|
62 ])
|
|
63
|
13
|
64 if not is_pi and not (host.name == 'prime'):
|
12
|
65 apt.packages(packages='mlocate', present=False)
|
|
66 apt.packages(packages='plocate')
|
|
67
|
|
68 if host.name == "bang":
|
|
69 apt.packages(packages=[
|
|
70 'zfsutils-linux',
|
|
71 'zfs-zed',
|
|
72 'zfs-auto-snapshot',
|
|
73 ])
|