Mercurial > code > home > repos > infra
comparison system.py @ 3:61945df2a392
updates to work on recent raspbian installs
author | drewp@bigasterisk.com |
---|---|
date | Sun, 07 Nov 2021 15:42:37 -0800 |
parents | 7f7af7e2ba8d |
children | aa633eb49c63 |
comparison
equal
deleted
inserted
replaced
2:7f7af7e2ba8d | 3:61945df2a392 |
---|---|
1 import os | 1 import os |
2 from pyinfra import host | 2 from pyinfra import host |
3 from pyinfra.operations import server, files, apt, ssh, systemd | 3 from pyinfra.operations import server, files, apt, ssh, systemd |
4 from pyinfra.facts.server import LinuxDistribution | 4 from pyinfra.facts.server import LinuxDistribution |
5 | 5 |
6 is_pi = host.get_fact(LinuxDistribution)['name'] == 'Debian' | 6 bang_is_old = True # remove after upgrade |
7 is_pi = host.get_fact(LinuxDistribution)['name'] in ['Debian', 'Raspbian GNU/Linux'] | |
7 is_wifi_pi = host.name in ['frontdoor', 'living'] | 8 is_wifi_pi = host.name in ['frontdoor', 'living'] |
8 | 9 |
9 TZ = 'America/Los_Angeles' | 10 TZ = 'America/Los_Angeles' |
10 | 11 |
11 # | 12 # |
96 apt.ppa(src="ppa:savoury1/blender") | 97 apt.ppa(src="ppa:savoury1/blender") |
97 | 98 |
98 apt.key(keyserver='keyserver.ubuntu.com', keyid='F24AEA9FB05498B7') | 99 apt.key(keyserver='keyserver.ubuntu.com', keyid='F24AEA9FB05498B7') |
99 apt.repo(src="deb [arch=amd64,i386] https://repo.steampowered.com/steam/ stable steam") | 100 apt.repo(src="deb [arch=amd64,i386] https://repo.steampowered.com/steam/ stable steam") |
100 | 101 |
101 if is_pi: | 102 if False and is_pi: |
102 apt.key(src="https://download.docker.com/linux/raspbian/gpg") | 103 apt.key(src="https://download.docker.com/linux/raspbian/gpg") |
103 apt.repo(src="deb [arch=armhf] https://download.docker.com/linux/raspbian stretch stable") | 104 apt.repo(src="deb [arch=armhf] https://download.docker.com/linux/raspbian stretch stable") |
104 apt.repo(src='deb http://deb.debian.org/debian/ unstable main') # maybe for WG | 105 apt.repo(src='deb http://deb.debian.org/debian/ unstable main') # maybe for WG |
105 | 106 |
106 # don't try to get aufs-dkms on rpi-- https://github.com/docker/for-linux/issues/709 | |
107 apt.packages(packages=['docker.io'], no_recommends=True) | |
108 | |
109 apt.packages(packages=[ | 107 apt.packages(packages=[ |
110 'build-essential', | 108 'build-essential', |
111 'i2c-tools', | 109 # 'i2c-tools', |
112 'keychain', | |
113 'python3-docker', | |
114 'python3-invoke', | |
115 'python3-pip', | |
116 'python3-virtualenv', | |
117 'rsync', | 110 'rsync', |
118 'sysstat', | |
119 ]) | 111 ]) |
120 | 112 |
121 if not is_pi: | 113 if not is_pi: |
114 apt.packages(packages=[ | |
115 'keychain', | |
116 'python3-docker', | |
117 'python3-invoke', | |
118 'python3-pip', | |
119 'python3-virtualenv', | |
120 'sysstat', | |
121 ]) | |
122 | |
123 if not is_pi and not bang_is_old: | |
122 apt.packages(packages='mlocate', present=False) | 124 apt.packages(packages='mlocate', present=False) |
123 apt.packages(packages='plocate') | 125 apt.packages(packages='plocate') |
124 | 126 |
125 # | 127 # |
126 # ssh | 128 # ssh |
145 | 147 |
146 # | 148 # |
147 # docker (delete this?) | 149 # docker (delete this?) |
148 # | 150 # |
149 | 151 |
150 files.put(src='files/docker_daemon.json', dest='/etc/docker/daemon.json') | 152 # don't try to get aufs-dkms on rpi-- https://github.com/docker/for-linux/issues/709 |
151 systemd.service(service='docker', running=True, enabled=True, restarted=True) | 153 if not is_pi: |
154 apt.packages(packages=['docker.io'], no_recommends=True) | |
155 files.put(src='files/docker_daemon.json', dest='/etc/docker/daemon.json') | |
156 systemd.service(service='docker', running=True, enabled=True, restarted=True) | |
152 | 157 |
153 if not is_pi: | 158 if not is_pi: |
154 files.line(path='/etc/update-manager/release-upgrades', line="^Prompt=", replace="Prompt=normal") | 159 files.line(path='/etc/update-manager/release-upgrades', line="^Prompt=", replace="Prompt=normal") |
155 | 160 |
156 files.line(path='/etc/ssh/sshd_config', line="^UseDNS\b", replace="UseDNS no") | 161 files.line(path='/etc/ssh/sshd_config', line="^UseDNS\b", replace="UseDNS no") |