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