diff system.py @ 155:522f26c8f691

split apt.py from system.py
author drewp@bigasterisk.com
date Thu, 16 Mar 2023 17:42:17 -0700
parents 2065998876e4
children 0d37dde619d0
line wrap: on
line diff
--- a/system.py	Sat Mar 11 12:34:04 2023 -0800
+++ b/system.py	Thu Mar 16 17:42:17 2023 -0700
@@ -2,8 +2,6 @@
 
 from pyinfra import host
 from pyinfra.facts.server import LinuxDistribution
-from pyinfra.facts.files import FindFiles
-from pyinfra.facts.server import Arch
 from pyinfra.operations import apt, files, server, systemd
 
 is_pi = host.get_fact(LinuxDistribution)['name'] in ['Debian', 'Raspbian GNU/Linux']
@@ -15,38 +13,6 @@
     files.link(path='/etc/localtime', target=f'/usr/share/zoneinfo/{TZ}')
     files.replace(path='/etc/timezone', text='.*', replace=TZ)
 
-def pkg_keys():
-    # apt.key(keyserver='keyserver.ubuntu.com', keyid='04EE7237B7D453EC')
-    # apt.key(keyserver='keyserver.ubuntu.com', keyid='648ACFD622F3D138')
-    # apt.key(keyserver='keyserver.ubuntu.com', keyid='8B48AD6246925553')
-    # apt.key(keyserver='keyserver.ubuntu.com', keyid='F24AEA9FB05498B7')
-    if host.name != 'prime':
-        apt.key(keyserver='keyserver.ubuntu.com', keyid='D0392EC59F9583BA')
-    apt.key(src='https://dl.google.com/linux/linux_signing_key.pub')
-    apt.key(src='https://ftp-master.debian.org/keys/archive-key-8-security.asc')
-    apt.key(src='https://ftp-master.debian.org/keys/archive-key-8.asc')
-    apt.key(src='https://ftp-master.debian.org/keys/archive-key-9-security.asc')
-    apt.key(src='https://packages.microsoft.com/keys/microsoft.asc')
-    apt.key(src='https://deb.nodesource.com/gpgkey/nodesource.gpg.key')
-
-    # Failed to fetch https://repo.steampowered.com/steam/dists/stable/InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY F24AEA9FB05498B7 
-
-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'
-                })
 
 def fstab():
     fstab_file = f'files/fstab/{host.name}'
@@ -97,8 +63,6 @@
 
 server.hostname(hostname=host.name)
 timezone()
-pkg_keys()
-apt_sources()
 fstab()
 
 if not is_pi: