From 69e2bcc966972751a2ad78df5d8bb29c8e89d417 Mon Sep 17 00:00:00 2001 From: DarkFeather Date: Thu, 30 Nov 2023 02:47:16 -0600 Subject: [PATCH] Evolution of deployment --- bin/generate-mirrorlist | 12 +++++++- examples/msn0.yml | 1 + roles/Geth-Hub/README.md | 6 +++- roles/Geth-Hub/files/lircd.conf/Geth-Hub-3 | 16 ----------- .../Geth-Hub/files/lircd.conf/LG-AKB73715608 | 28 +++++++++++++++++++ roles/Geth-Hub/files/lircd.conf/NS-RC4NA-14 | 28 +++++++++++++++++++ roles/Geth-Hub/tasks/main.yml | 17 ++++++++++- roles/Geth-Hub/templates/snmpd.conf.j2 | 23 +++++++++++++++ roles/IRC/README.md | 11 ++++++++ roles/Maat/files/pacoloco.yaml | 14 ++++++++++ roles/Maat/tasks/main.yml | 22 +++++++++++++++ roles/ShadowArch/files/motd/Node1 | 6 ++++ roles/ShadowArch/files/motd/Node2 | 6 ++++ roles/ShadowArch/files/motd/Node3 | 6 ++++ roles/ShadowArch/tasks/main.yml | 12 +++----- roles/ShadowArch/tasks/raspbian-network.yml | 4 +++ roles/Sharingan/files/monit/hostdefs/Node1 | 1 + roles/Sharingan/files/monit/hostdefs/Node2 | 1 + roles/Sharingan/files/monit/hostdefs/Node3 | 1 + .../files/sharingan-heartbeat.service | 2 +- roles/common/service_account.yml | 7 +++++ 21 files changed, 196 insertions(+), 28 deletions(-) create mode 100644 roles/Geth-Hub/files/lircd.conf/LG-AKB73715608 create mode 100644 roles/Geth-Hub/files/lircd.conf/NS-RC4NA-14 create mode 100644 roles/Geth-Hub/templates/snmpd.conf.j2 create mode 100644 roles/Maat/files/pacoloco.yaml create mode 100644 roles/ShadowArch/files/motd/Node1 create mode 100644 roles/ShadowArch/files/motd/Node2 create mode 100644 roles/ShadowArch/files/motd/Node3 create mode 100644 roles/Sharingan/files/monit/hostdefs/Node1 create mode 100644 roles/Sharingan/files/monit/hostdefs/Node2 create mode 100644 roles/Sharingan/files/monit/hostdefs/Node3 create mode 100644 roles/common/service_account.yml diff --git a/bin/generate-mirrorlist b/bin/generate-mirrorlist index 58ffe48..5974545 100755 --- a/bin/generate-mirrorlist +++ b/bin/generate-mirrorlist @@ -1,4 +1,14 @@ #!/bin/bash curl -s https://raw.githubusercontent.com/archlinux/svntogit-packages/packages/pacman-mirrorlist/trunk/mirrorlist | awk '/^## United States$/{f=1; next}f==0{next}/^$/{exit}{print substr($0, 1);}' | sed 's/^#Server/Server/' > /tmp/candidates -rankmirrors -n 6 /tmp/candidates > ../roles/ShadowArch/files/mirrorlist +cat < ../roles/Maat/files/pacoloco.yaml +port: 9129 +download_timeout: 3600 # download will timeout after 3600 seconds +cache_dir: /var/cache/pacoloco +purge_files_after: 360000 # 360000 seconds or 100 hours, 0 to disable +repos: + archlinux: + urls: +$(rankmirrors -n 6 /tmp/candidates | sed 's/^Server = / - /' | grep -v generated\ by | cut -f 1 -d \$) +user_agent: Pacoloco +EOM diff --git a/examples/msn0.yml b/examples/msn0.yml index f08688f..bf69562 100644 --- a/examples/msn0.yml +++ b/examples/msn0.yml @@ -12,6 +12,7 @@ all: dns: "10.0.1.2" logserver: "10.0.1.16" webfront: "10.0.1.3" + mirroruri: "http://Maat.MSN0.AniNIX.net:9129/repo/archlinux/$repo/os/$arch" # Standards daemon_shell: /sbin/nologin user_shell: /bin/bash diff --git a/roles/Geth-Hub/README.md b/roles/Geth-Hub/README.md index 6e6f0ab..28a9955 100644 --- a/roles/Geth-Hub/README.md +++ b/roles/Geth-Hub/README.md @@ -6,5 +6,9 @@ For the camera, we use the [motion](https://motion-project.github.io/motion_conf For the IR control we use an [IR shield](https://www.amazon.com/s?k=Raspberry+pi+infrared+expansion+board+IR+transmitter&ref=nb_sb_noss) controlled by the [lircd](https://www.lirc.org/) service. As a note, in order for this to work, you have to set the pinout in the `/boot/config.txt` -- we try to default this in, but you may need to set `gpio_in_pin` and `gpio_out_pin` attributes for your particular board and shield. -We also pass in an SSH key to integrate with the [Geth](../Geth/) command service, so that users don't have to connect to the boards directly. +We also set up an SNMPv3 daemon service on the hubs, to work with their IR control. This snmpd requires the Geth OVA to add snmpget using `apk update && apk add net-snmp-tools` from the `Terminal & SSH` add-on. Covers can then be added from the [command-line integration](https://www.home-assistant.io/integrations/command_line/). They'll look something like this: + +``` + +``` diff --git a/roles/Geth-Hub/files/lircd.conf/Geth-Hub-3 b/roles/Geth-Hub/files/lircd.conf/Geth-Hub-3 index 2ed829e..69b5a35 100644 --- a/roles/Geth-Hub/files/lircd.conf/Geth-Hub-3 +++ b/roles/Geth-Hub/files/lircd.conf/Geth-Hub-3 @@ -1,17 +1,3 @@ - -# Please make this file available to others -# by sending it to -# -# this config file was automatically generated -# using lirc-0.9.0-pre1(default) on Thu Jun 29 00:24:26 2017 -# -# contributed by darkfeather@aninix.net -# -# brand: LG.conf -# model no. of remote control: AKB73715608 -# devices being controlled by this remote: TV -# - begin remote name LG-AKB73715608 @@ -40,5 +26,3 @@ begin remote end codes end remote - - diff --git a/roles/Geth-Hub/files/lircd.conf/LG-AKB73715608 b/roles/Geth-Hub/files/lircd.conf/LG-AKB73715608 new file mode 100644 index 0000000..69b5a35 --- /dev/null +++ b/roles/Geth-Hub/files/lircd.conf/LG-AKB73715608 @@ -0,0 +1,28 @@ +begin remote + + name LG-AKB73715608 + bits 16 + flags SPACE_ENC|CONST_LENGTH + eps 30 + aeps 100 + + header 9063 4496 + one 579 1673 + zero 579 546 + ptrail 580 + repeat 9066 2248 + pre_data_bits 16 + pre_data 0x20DF + gap 108528 + toggle_bit_mask 0x0 + + begin codes + KEY_POWER 0x10EF + KEY_VOLUMEUP 0x40BF + KEY_VOLUMEDOWN 0xC03F + KEY_CONFIG 0xD02F + KEY_ENTER 0x22DD + KEY_MUTE 0x906F + end codes + +end remote diff --git a/roles/Geth-Hub/files/lircd.conf/NS-RC4NA-14 b/roles/Geth-Hub/files/lircd.conf/NS-RC4NA-14 new file mode 100644 index 0000000..60e2903 --- /dev/null +++ b/roles/Geth-Hub/files/lircd.conf/NS-RC4NA-14 @@ -0,0 +1,28 @@ +begin remote + + name NS-RC4NA-14 + bits 16 + flags SPACE_ENC|CONST_LENGTH + eps 30 + aeps 100 + + header 9102 4441 + one 640 1623 + zero 640 496 + ptrail 639 + repeat 9103 2189 + pre_data_bits 16 + pre_data 0x61A0 + gap 108350 + toggle_bit_mask 0x0 + + begin codes + KEY_POWER 0xF00F + KEY_CONFIG 0xB847 + KEY_VOLUMEUP 0x30CF + KEY_VOLUMEDOWN 0xB04F + KEY_MUTE 0x708F + KEY_ENTER 0x18E7 + end codes + +end remote diff --git a/roles/Geth-Hub/tasks/main.yml b/roles/Geth-Hub/tasks/main.yml index 8fdadb6..6f621e4 100644 --- a/roles/Geth-Hub/tasks/main.yml +++ b/roles/Geth-Hub/tasks/main.yml @@ -6,6 +6,7 @@ name: - motion - lirc + - snmpd - libcamera-apps - ir-keytable state: present @@ -120,7 +121,7 @@ register: lircd_remote_config become: yes copy: - src: "lircd.conf/{{ inventory_hostname }}" + src: "lircd.conf/{{ remote }}" dest: /etc/lirc/lircd.conf - name: Start the services @@ -130,3 +131,17 @@ name: lircd state: restarted enabled: yes + + + - name: SNMPD config + become: yes + template: + src: snmpd.conf.j2 + dest: /etc/snmp/snmpd.conf + + - name: SNMPD service + become: yes + service: + name: snmpd + state: restarted + enabled: yes diff --git a/roles/Geth-Hub/templates/snmpd.conf.j2 b/roles/Geth-Hub/templates/snmpd.conf.j2 new file mode 100644 index 0000000..8487243 --- /dev/null +++ b/roles/Geth-Hub/templates/snmpd.conf.j2 @@ -0,0 +1,23 @@ +sysLocation {{ inventory_hostname }} +sysContact {{ organization['admin'] }} <{{ organization['email'] }}> + +sysServices 72 + +master agentx + +agentaddress {{ ip }}:161 + +view systemonly included .1.3.6.1.2.1.1 +view systemonly included .1.3.6.1.2.1.25.1 +view remotecmds included .1 + +CreateUser remote SHA {{ passwords[inventory_hostname] }} AES {{ passwords[inventory_hostname] }} + +rouser remote priv .1 + +extend -cacheTime 1 power /usr/bin/irsend SEND_ONCE {{ remote }} KEY_POWER +extend -cacheTime 1 mute /usr/bin/irsend SEND_ONCE {{ remote }} KEY_MUTE +extend -cacheTime 1 volumeup /usr/bin/irsend SEND_ONCE {{ remote }} KEY_VOLUMEUP +extend -cacheTime 1 volumedown /usr/bin/irsend SEND_ONCE {{ remote }} KEY_VOLUMEDOWN +extend -cacheTime 1 config /usr/bin/irsend SEND_ONCE {{ remote }} KEY_CONFIG +extend -cacheTime 1 enter /usr/bin/irsend SEND_ONCE {{ remote }} KEY_ENTER diff --git a/roles/IRC/README.md b/roles/IRC/README.md index 2096fb5..49e2185 100644 --- a/roles/IRC/README.md +++ b/roles/IRC/README.md @@ -28,6 +28,17 @@ The following entities can be messaged personally (PM'ed) for help with `/msg