Mercurial > code > home > repos > infra
changeset 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 | 53ab69ba2d07 |
files | inventory.py system.py tasks.py users.py |
diffstat | 4 files changed, 28 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/inventory.py Thu Nov 04 18:26:04 2021 -0700 +++ b/inventory.py Sun Nov 07 15:42:37 2021 -0800 @@ -8,4 +8,5 @@ ] pi = [ 'frontbed', + ('garage', {'ssh_hostname': '10.2.0.19'}), ]
--- a/system.py Thu Nov 04 18:26:04 2021 -0700 +++ b/system.py Sun Nov 07 15:42:37 2021 -0800 @@ -3,7 +3,8 @@ from pyinfra.operations import server, files, apt, ssh, systemd from pyinfra.facts.server import LinuxDistribution -is_pi = host.get_fact(LinuxDistribution)['name'] == 'Debian' +bang_is_old = True # remove after upgrade +is_pi = host.get_fact(LinuxDistribution)['name'] in ['Debian', 'Raspbian GNU/Linux'] is_wifi_pi = host.name in ['frontdoor', 'living'] TZ = 'America/Los_Angeles' @@ -98,27 +99,28 @@ apt.key(keyserver='keyserver.ubuntu.com', keyid='F24AEA9FB05498B7') apt.repo(src="deb [arch=amd64,i386] https://repo.steampowered.com/steam/ stable steam") -if is_pi: +if False and is_pi: apt.key(src="https://download.docker.com/linux/raspbian/gpg") apt.repo(src="deb [arch=armhf] https://download.docker.com/linux/raspbian stretch stable") apt.repo(src='deb http://deb.debian.org/debian/ unstable main') # maybe for WG -# don't try to get aufs-dkms on rpi-- https://github.com/docker/for-linux/issues/709 -apt.packages(packages=['docker.io'], no_recommends=True) - apt.packages(packages=[ 'build-essential', - 'i2c-tools', - 'keychain', - 'python3-docker', - 'python3-invoke', - 'python3-pip', - 'python3-virtualenv', +# 'i2c-tools', 'rsync', - 'sysstat', ]) if not is_pi: + apt.packages(packages=[ + 'keychain', + 'python3-docker', + 'python3-invoke', + 'python3-pip', + 'python3-virtualenv', + 'sysstat', + ]) + +if not is_pi and not bang_is_old: apt.packages(packages='mlocate', present=False) apt.packages(packages='plocate') @@ -147,8 +149,11 @@ # docker (delete this?) # -files.put(src='files/docker_daemon.json', dest='/etc/docker/daemon.json') -systemd.service(service='docker', running=True, enabled=True, restarted=True) +# don't try to get aufs-dkms on rpi-- https://github.com/docker/for-linux/issues/709 +if not is_pi: + apt.packages(packages=['docker.io'], no_recommends=True) + files.put(src='files/docker_daemon.json', dest='/etc/docker/daemon.json') + systemd.service(service='docker', running=True, enabled=True, restarted=True) if not is_pi: files.line(path='/etc/update-manager/release-upgrades', line="^Prompt=", replace="Prompt=normal")
--- a/tasks.py Thu Nov 04 18:26:04 2021 -0700 +++ b/tasks.py Sun Nov 07 15:42:37 2021 -0800 @@ -5,12 +5,16 @@ export HOME eval `keychain --quiet --eval id_ecdsa` cd /my/proj/infra -env/bin/pyinfra inventory.py ''' +env/bin/pyinfra ''' @task def users(ctx): - ctx.run(cmd + 'users.py', pty=True) + ctx.run(cmd + 'inventory.py users.py', pty=True) @task def system(ctx): - ctx.run(cmd + 'system.py', pty=True) + ctx.run(cmd + 'inventory.py system.py', pty=True) + +@task +def get_fact(ctx, host='dash', fact='server.LinuxDistribution'): + ctx.run(cmd + f'{host} fact {fact}', pty=True)
--- a/users.py Thu Nov 04 18:26:04 2021 -0700 +++ b/users.py Sun Nov 07 15:42:37 2021 -0800 @@ -2,7 +2,7 @@ from pyinfra.operations import server from pyinfra.facts.server import LinuxDistribution -is_pi = host.get_fact(LinuxDistribution)['name'] == 'Debian' +is_pi = host.get_fact(LinuxDistribution)['name'] in ['Debian', 'Raspbian GNU/Linux'] # raspbian took 1000 for 'pi' group, but drewp is rarely used on pi # setups so hopefully it won't matter much that drew group has a