Mercurial > code > home > repos > infra
view apt.py @ 191:d7ddfe3837b0
syncthing clients update
author | drewp@bigasterisk.com |
---|---|
date | Mon, 12 Jun 2023 13:07:42 -0700 |
parents | 087b84e68765 |
children | ee6374edfc06 |
line wrap: on
line source
from pyinfra import host from pyinfra.facts.files import FindFiles from pyinfra.facts.server import Arch, LinuxDistribution from pyinfra.operations import apt, files, server TZ = 'America/Los_Angeles' def pkg_keys(): files.directory(path='/etc/apt/keyrings/') # for raspi for url, name in [ ('https://repo.steampowered.com/steam/archive/stable/steam.gpg', 'steam.gpg'), ]: files.download(src=url, dest=f'/etc/apt/keyrings/{name}') server.shell(commands=[ f"curl -fsSL {url} | gpg --dearmor > /etc/apt/keyrings/{name}" for (url, name) in [ ('https://packages.microsoft.com/keys/microsoft.asc', 'ms.gpg'), ('https://deb.nodesource.com/gpgkey/nodesource.gpg.key', 'nodesource.gpg'), ('https://dl.google.com/linux/linux_signing_key.pub', 'chrome.gpg'), ] ]) def apt_sources(): if host.get_fact(Arch) == 'x86_64': server.shell(commands=['dpkg --add-architecture i386']) files.template(src='templates/sources.list.j2', dest='/etc/apt/sources.list') if host.get_fact(FindFiles, '/etc/apt/sources.list.d/', quote_path=True): raise SystemExit(f"new files in {host.name} /etc/apt/sources.list.d/ - please remove") apt.packages(update=True, cache_time=86400, packages=['tzdata'], force=True, _env={ 'TZ': TZ, 'LANG': 'en_US.UTF-8', 'DEBIAN_FRONTEND': 'noninteractive' }) # squib 1st setup seemed to need more updates for node(nodesource) # and steam-launcher pkg_keys() apt_sources()