Mercurial > code > home > repos > infra
annotate packages.py @ 98:3d4340fbb16c
finish moving these lines from system.py
author | drewp@bigasterisk.com |
---|---|
date | Fri, 15 Jul 2022 14:36:00 -0700 |
parents | e4613207a78b |
children | 8b8ef9d8f0fd |
rev | line source |
---|---|
12 | 1 from pyinfra import host |
2 from pyinfra.facts.server import LinuxDistribution | |
49 | 3 from pyinfra.operations import apt, files, ssh, server |
12 | 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 | |
69 | 11 if host.name == 'pipe': |
12 apt.packages(packages=['mandb', 'apt-listchanges'], present=False) | |
13 files.template(src='templates/odroid_sources.list.j2', dest='/etc/apt/sources.list', rel='focal') | |
14 | |
15 elif is_pi: | |
12 | 16 apt.packages(packages=['mandb', 'apt-listchanges'], present=False) |
17 files.template(src='templates/pi_sources.list.j2', dest='/etc/apt/sources.list', rel='bullseye') | |
18 # 'apt upgrade'? | |
42 | 19 apt.packages( |
20 update=False, # see system.py | |
74 | 21 packages=['dirmngr', 'gnupg2', 'apt-utils', 'aptitude']) |
12 | 22 |
23 apt.key(src='https://ftp-master.debian.org/keys/archive-key-8.asc') | |
24 apt.key(src='https://ftp-master.debian.org/keys/archive-key-8-security.asc') | |
25 apt.key(src='https://ftp-master.debian.org/keys/archive-key-9-security.asc') | |
13 | 26 apt.key(keyserver='keyserver.ubuntu.com', keyid='04EE7237B7D453EC') |
27 apt.key(keyserver='keyserver.ubuntu.com', keyid='648ACFD622F3D138') | |
12 | 28 |
29 files.file(path='/etc/apt/sources.list.d/raspi.list', present=False) | |
30 | |
31 if is_wifi_pi: | |
32 files.put(dest="/etc/network/interfaces.d/wlan0", src="files/pi_wlan0_powersave") | |
33 ssh.command(host.name, "iw wlan0 set power_save off") | |
34 | |
35 files.template(src='templates/boot_config.txt.j2', dest='/boot/config.txt') | |
36 | |
37 if not is_pi and host.name != 'prime': | |
38 apt.key(src='https://dl.google.com/linux/linux_signing_key.pub') | |
39 apt.repo(src='deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main') | |
40 | |
41 apt.key(src='https://packages.microsoft.com/keys/microsoft.asc') | |
42 apt.repo(src="deb [arch=amd64,arm64,armhf] http://packages.microsoft.com/repos/code stable main") | |
43 | |
44 apt.key(keyserver='keyserver.ubuntu.com', keyid='F24AEA9FB05498B7') | |
45 apt.repo(src="deb [arch=amd64,i386] https://repo.steampowered.com/steam/ stable steam") | |
46 | |
47 apt.packages(packages=[ | |
48 'build-essential', | |
49 # 'i2c-tools', | |
50 'rsync', | |
51 'dstat', | |
52 'ifstat', | |
24 | 53 'mosquitto-clients', |
54 'ncdu', | |
42 | 55 "udns-utils", |
56 | 56 "atool", |
85
1ac08aba5ae5
docker->podman, and some pkgs + inventory
drewp@bigasterisk.com
parents:
83
diff
changeset
|
57 "wireguard-tools", |
74 | 58 'iproute2', # needed for wireguard |
85
1ac08aba5ae5
docker->podman, and some pkgs + inventory
drewp@bigasterisk.com
parents:
83
diff
changeset
|
59 'kitty-terminfo', |
1ac08aba5ae5
docker->podman, and some pkgs + inventory
drewp@bigasterisk.com
parents:
83
diff
changeset
|
60 'zsh', |
1ac08aba5ae5
docker->podman, and some pkgs + inventory
drewp@bigasterisk.com
parents:
83
diff
changeset
|
61 'xosview', |
12 | 62 ]) |
63 | |
64 if not is_pi: | |
65 apt.packages(packages=[ | |
93 | 66 'debian-goodies', |
67 'ethtool', | |
68 'htop', | |
69 'iotop', | |
12 | 70 'keychain', |
93 | 71 'lpr', |
72 'mercurial', | |
73 'mtr-tiny', | |
74 'net-tools', | |
75 'nodejs', | |
76 'npm', | |
77 'oping', | |
12 | 78 'python3-invoke', |
79 'python3-pip', | |
80 'python3-virtualenv', | |
93 | 81 'speedtest-cli', |
12 | 82 'sysstat', |
74 | 83 'tcpdump', |
12 | 84 ]) |
93 | 85 if host.name in ['dash', 'slash', 'bang']: |
86 apt.packages(packages=[ | |
87 'podman-docker', | |
88 ]) | |
83 | 89 if host.name != 'pipe': |
90 apt.packages(packages=[ | |
91 'reptyr', | |
92 ]) | |
93 | |
75 | 94 vers = '0.25.2' # see https://github.com/kovidgoyal/kitty/releases |
49 | 95 home = '/home/drewp' |
96 local = f"{home}/.local/kitty" | |
56 | 97 dl = f'/tmp/kitty-{vers}-x86_64.txz' |
49 | 98 files.download(src=f"https://github.com/kovidgoyal/kitty/releases/download/v{vers}/kitty-{vers}-x86_64.txz", |
56 | 99 dest=dl) |
60 | 100 files.directory(local) |
49 | 101 server.shell([ |
56 | 102 f"mkdir -p {local}", # https://github.com/Fizzadar/pyinfra/issues/777 |
103 f"aunpack --extract-to={local} {dl}", | |
49 | 104 ]) |
105 files.link(target="{local}/bin/kitty", path="{home}/bin/kitty") | |
12 | 106 |
56 | 107 server.shell([ |
62 | 108 # https://github.com/pnpm/pnpm/releases |
77
996f39b03494
hold back pnpm version for older nodejs
drewp@bigasterisk.com
parents:
75
diff
changeset
|
109 # but also https://pnpm.io/installation#compatibility |
996f39b03494
hold back pnpm version for older nodejs
drewp@bigasterisk.com
parents:
75
diff
changeset
|
110 "npm install -g pnpm@6.32.22", |
56 | 111 ]) |
112 | |
72
f0e59adf7b91
updates that aren't pkg or version changes
drewp@bigasterisk.com
parents:
69
diff
changeset
|
113 apt.packages(packages='mlocate', present=False) |
f0e59adf7b91
updates that aren't pkg or version changes
drewp@bigasterisk.com
parents:
69
diff
changeset
|
114 if not is_pi and host.name not in ['prime', 'pipe']: |
12 | 115 apt.packages(packages='plocate') |
116 | |
117 if host.name == "bang": | |
118 apt.packages(packages=[ | |
85
1ac08aba5ae5
docker->podman, and some pkgs + inventory
drewp@bigasterisk.com
parents:
83
diff
changeset
|
119 'dnsmasq', |
34
d4fb38f13c79
refactor dns and some other non-net setup
drewp@bigasterisk.com
parents:
25
diff
changeset
|
120 'iptables', |
d4fb38f13c79
refactor dns and some other non-net setup
drewp@bigasterisk.com
parents:
25
diff
changeset
|
121 'openntpd', |
d4fb38f13c79
refactor dns and some other non-net setup
drewp@bigasterisk.com
parents:
25
diff
changeset
|
122 'ntpdate', |
12 | 123 'zfsutils-linux', |
124 'zfs-zed', | |
125 'zfs-auto-snapshot', | |
126 ]) | |
37
fbd0849dfdbd
redo networking to be much simpler. Uses systemd-networkd
drewp@bigasterisk.com
parents:
34
diff
changeset
|
127 |
fbd0849dfdbd
redo networking to be much simpler. Uses systemd-networkd
drewp@bigasterisk.com
parents:
34
diff
changeset
|
128 if host.name == 'plus': |
42 | 129 apt.packages(packages=['network-manager']) |