Mercurial > code > home > repos > infra
changeset 10:1fec9fe18a4e
more system.py cleanup; add pi /boot/config.txt
author | drewp@bigasterisk.com |
---|---|
date | Thu, 11 Nov 2021 22:22:34 -0800 |
parents | 7e76e6dcc080 |
children | 82e46d7ff527 |
files | files/dash_fstab system.py templates/boot_config.txt.j2 |
diffstat | 3 files changed, 93 insertions(+), 40 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/files/dash_fstab Thu Nov 11 22:22:34 2021 -0800 @@ -0,0 +1,6 @@ +# <file system> <mount point> <type> <options> <dump> <pass> +/dev/disk/by-uuid/3b6780e0-ec86-43be-8d09-e462dbad762e / ext4 defaults 0 0 +/dev/disk/by-uuid/b88f75cd-9022-4af9-a11b-5a5a1fbd3132 /d2 ext4 defaults 0 0 +/dev/disk/by-uuid/73bcd201-5f77-4f68-9fba-47835c3c1692 /prev ext4 defaults 0 0 +/swap.img none swap sw 0 0 +bang:/stor6/my /my nfs4 defaults 0 0
--- a/system.py Thu Nov 11 22:21:15 2021 -0800 +++ b/system.py Thu Nov 11 22:22:34 2021 -0800 @@ -1,7 +1,8 @@ import os + from pyinfra import host -from pyinfra.operations import server, files, apt, ssh, systemd from pyinfra.facts.server import LinuxDistribution +from pyinfra.operations import apt, files, server, ssh, systemd bang_is_old = True # remove after upgrade is_pi = host.get_fact(LinuxDistribution)['name'] in ['Debian', 'Raspbian GNU/Linux'] @@ -66,30 +67,9 @@ files.put(dest="/etc/network/interfaces.d/wlan0", src="files/pi_wlan0_powersave") ssh.command(host.name, "iw wlan0 set power_save off") - # see https://www.raspberrypi.org/documentation/configuration/config-txt/memory.md#:~:text=txt-,gpu_mem,-Specifies - # to port to pyinfra - #- name: unused display; give ram to OS - # lineinfile: dest=/boot/config.txt line="gpu_mem=16" regexp="^gpu_mem=" - # when: "'with_x11' not in group_names" - - # for beacon - #enable_uart=1 - #dtoverlay=pi3-miniuart-bt - #core_freq=250 + files.template(src='templates/boot_config.txt.j2', dest='/boot/config.txt') - # for tiny_screen - #to port to pyinfra - #- lineinfile: dest=/boot/config.txt line="dtparam=spi=on" regexp="^dtparam=spi=" - - # i hope this is deletable - # downgrade strictness so I can install from https://archive.raspberrypi.org/ - # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=907788 - #- lineinfile: dest=/etc/ssl/openssl.cnf line="#CipherString = DEFAULT@SECLEVEL=2" regexp="CipherString ?=" - - # may be fixed in k3s, not sure - # raspbian defaults to `iptables -V` -> iptables v1.8.4 (nf_tables), which won't work with k3s - # - command: update-alternatives --set iptables /usr/sbin/iptables-legacy -if not is_pi: +if not is_pi and host.name != 'prime': apt.key(src='https://dl.google.com/linux/linux_signing_key.pub') apt.repo(src='deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main') @@ -101,15 +81,12 @@ apt.key(keyserver='keyserver.ubuntu.com', keyid='F24AEA9FB05498B7') apt.repo(src="deb [arch=amd64,i386] https://repo.steampowered.com/steam/ stable steam") -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 - apt.packages(packages=[ 'build-essential', -# 'i2c-tools', + # 'i2c-tools', 'rsync', + 'dstat', + 'ifstat', ]) if not is_pi: @@ -174,13 +151,3 @@ 'zfs-zed', 'zfs-auto-snapshot', ]) - -# This is usable on pi where we don't care when they reboot: -#- name: apt_upgrade -# apt: upgrade=full -#- name: Check if a reboot is required -# register: file -# stat: path=/var/run/reboot-required get_md5=no -#- name: Reboot the server -# command: /sbin/reboot -# when: file.stat.exists == true
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/templates/boot_config.txt.j2 Thu Nov 11 22:22:34 2021 -0800 @@ -0,0 +1,80 @@ +# Written by pyinfra + +# For more options and information see +# http://rpf.io/configtxt +# Some settings may impact device functionality. See link above for details + +# uncomment if you get no picture on HDMI for a default "safe" mode +#hdmi_safe=1 + +# uncomment this if your display has a black border of unused pixels visible +# and your display can output without overscan +#disable_overscan=1 + +# uncomment the following to adjust overscan. Use positive numbers if console +# goes off screen, and negative if there is too much border +#overscan_left=16 +#overscan_right=16 +#overscan_top=16 +#overscan_bottom=16 + +# uncomment to force a console size. By default it will be display's size minus +# overscan. +#framebuffer_width=1280 +#framebuffer_height=720 + +# uncomment if hdmi display is not detected and composite is being output +#hdmi_force_hotplug=1 + +# uncomment to force a specific HDMI mode (this will force VGA) +#hdmi_group=1 +#hdmi_mode=1 + +# uncomment to force a HDMI mode rather than DVI. This can make audio work in +# DMT (computer monitor) modes +#hdmi_drive=2 + +# uncomment to increase signal to HDMI, if you have interference, blanking, or +# no display +#config_hdmi_boost=4 + +# uncomment for composite PAL +#sdtv_mode=2 + +#uncomment to overclock the arm. 700 MHz is the default. +#arm_freq=800 + +# Uncomment some or all of these to enable the optional hardware interfaces +#dtparam=i2c_arm=on +#dtparam=i2s=on +#dtparam=spi=on + +# Uncomment this to enable infrared communication. +#dtoverlay=gpio-ir,gpio_pin=17 +#dtoverlay=gpio-ir-tx,gpio_pin=18 + +# Additional overlays and parameters are documented /boot/overlays/README + +# Enable audio (loads snd_bcm2835) +dtparam=audio=off + +[pi4] +# Enable DRM VC4 V3D driver on top of the dispmanx display stack +dtoverlay=vc4-fkms-v3d +max_framebuffers=2 + +[all] +#dtoverlay=vc4-fkms-v3d +dtoverlay=w1-gpio,gpiopin=17,pullup=y +gpu_mem=16 + +######################## +# unreviewed + +# for beacon +#enable_uart=1 +#dtoverlay=pi3-miniuart-bt +#core_freq=250 + +# for tiny_screen +#- lineinfile: dest=/boot/config.txt line="dtparam=spi=on" regexp="^dtparam=spi="