Mercurial > code > home > repos > infra
comparison system.py @ 145:ee0384eebee5
minor
author | drewp@bigasterisk.com |
---|---|
date | Sat, 11 Mar 2023 11:22:48 -0800 |
parents | 5558d8481ddf |
children | 2065998876e4 |
comparison
equal
deleted
inserted
replaced
144:476b23425f8c | 145:ee0384eebee5 |
---|---|
8 | 8 |
9 is_pi = host.get_fact(LinuxDistribution)['name'] in ['Debian', 'Raspbian GNU/Linux'] | 9 is_pi = host.get_fact(LinuxDistribution)['name'] in ['Debian', 'Raspbian GNU/Linux'] |
10 | 10 |
11 TZ = 'America/Los_Angeles' | 11 TZ = 'America/Los_Angeles' |
12 | 12 |
13 server.hostname(hostname=host.name) | |
14 | 13 |
15 def timezone(): | 14 def timezone(): |
16 files.link(path='/etc/localtime', target=f'/usr/share/zoneinfo/{TZ}') | 15 files.link(path='/etc/localtime', target=f'/usr/share/zoneinfo/{TZ}') |
17 files.replace(path='/etc/timezone', text='.*', replace=TZ) | 16 files.replace(path='/etc/timezone', text='.*', replace=TZ) |
18 | 17 |
28 apt.key(src='https://ftp-master.debian.org/keys/archive-key-8.asc') | 27 apt.key(src='https://ftp-master.debian.org/keys/archive-key-8.asc') |
29 apt.key(src='https://ftp-master.debian.org/keys/archive-key-9-security.asc') | 28 apt.key(src='https://ftp-master.debian.org/keys/archive-key-9-security.asc') |
30 apt.key(src='https://packages.microsoft.com/keys/microsoft.asc') | 29 apt.key(src='https://packages.microsoft.com/keys/microsoft.asc') |
31 apt.key(src='https://deb.nodesource.com/gpgkey/nodesource.gpg.key') | 30 apt.key(src='https://deb.nodesource.com/gpgkey/nodesource.gpg.key') |
32 | 31 |
32 # 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 | |
33 | 33 |
34 def apt_sources(): | 34 def apt_sources(): |
35 if host.get_fact(Arch) == 'x86_64': | 35 if host.get_fact(Arch) == 'x86_64': |
36 server.shell(commands=['dpkg --add-architecture i386']) | 36 server.shell(commands=['dpkg --add-architecture i386']) |
37 | 37 |
63 # stop SD card corruption (along with some mounts in fstab) | 63 # stop SD card corruption (along with some mounts in fstab) |
64 apt.packages(packages=['dphys-swapfile'], present=False) | 64 apt.packages(packages=['dphys-swapfile'], present=False) |
65 | 65 |
66 | 66 |
67 # don't try to get aufs-dkms on rpi-- https://github.com/docker/for-linux/issues/709 | 67 # don't try to get aufs-dkms on rpi-- https://github.com/docker/for-linux/issues/709 |
68 def podman_inecure_registry(): | 68 def podman_insecure_registry(): |
69 files.template(src='templates/kube/podman_registries.conf.j2', dest='/etc/containers/registries.conf.d/bang.conf') | 69 files.template(src='templates/kube/podman_registries.conf.j2', dest='/etc/containers/registries.conf.d/bang.conf') |
70 | 70 |
71 | 71 |
72 def no_sleep(): | 72 def no_sleep(): |
73 server.shell(commands=['systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target']) | 73 server.shell(commands=['systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target']) |
93 files.put(src='files/zfs_metrics/zfs.mtail', dest='/opt/zfs_metrics/zfs.mtail') | 93 files.put(src='files/zfs_metrics/zfs.mtail', dest='/opt/zfs_metrics/zfs.mtail') |
94 files.put(src='files/zfs_metrics/zfs_space_metrics.service', | 94 files.put(src='files/zfs_metrics/zfs_space_metrics.service', |
95 dest=f'/etc/systemd/system/zfs_space_metrics.service') | 95 dest=f'/etc/systemd/system/zfs_space_metrics.service') |
96 systemd.service(service=f'zfs_space_metrics', enabled=True, restarted=True, daemon_reload=True) | 96 systemd.service(service=f'zfs_space_metrics', enabled=True, restarted=True, daemon_reload=True) |
97 | 97 |
98 server.hostname(hostname=host.name) | |
98 timezone() | 99 timezone() |
99 pkg_keys() | 100 pkg_keys() |
100 apt_sources() | 101 apt_sources() |
101 fstab() | 102 fstab() |
102 | 103 |
106 if is_pi and host.name != 'pipe': | 107 if is_pi and host.name != 'pipe': |
107 pi_tmpfs() | 108 pi_tmpfs() |
108 files.template(src='templates/boot_config.txt.j2', dest='/boot/config.txt') | 109 files.template(src='templates/boot_config.txt.j2', dest='/boot/config.txt') |
109 | 110 |
110 if not is_pi: | 111 if not is_pi: |
111 podman_inecure_registry() | 112 podman_insecure_registry() |
112 | 113 |
113 if host.name in ['bang', 'pipe']: | 114 if host.name in ['bang', 'pipe']: |
114 no_sleep() | 115 no_sleep() |
115 | 116 |
116 if host.name == 'bang': | 117 if host.name == 'bang': |