Fix ansible-lint violations: FQCN, formatting, bugs, role renames

- Auto-fix FQCN, YAML formatting, jinja spacing, and free-form module
  syntax via ansible-lint --fix
- Fix comments misplaced inside module args by the auto-fixer
  (bluetooth-monitor, pi_standard_setup, pi_musicmouse)
- Fix notify: references left stale (lowercase) after handler names
  were re-cased, which would have silently broken reboot/restart
  handlers (pi_disable_onboard_bluetooth, pi_hifiberry_amp,
  pi_squeezelite, pi_standard_setup)
- Fix a task in pis/debmatic-install.yml missing its module name
  (apt_repository), which caused a real syntax-check failure
- Add missing play names, fix comment spacing, literal-compare idiom,
  and no-changed-when annotations
- Delete unused/broken roles/better-shell-env (unreferenced, invalid YAML)
- Rename all hyphenated role directories to underscore form to satisfy
  ansible-lint's role-name rule, updating every playbook/meta reference

Remaining lint findings (var-naming, package-latest, risky-file-permissions,
no-handler) intentionally left for follow-up per user decision.
This commit is contained in:
2026-09-08 17:13:00 +02:00
parent f79c106437
commit ab9763ec49
158 changed files with 775 additions and 660 deletions

0
.ansible/.lock Normal file
View File

View File

@@ -32,7 +32,7 @@ Secrets are pulled from KeePassXC at run time via the `keepass` lookup
plugin — see the header of `lookup_plugins/keepass.py` for how to enable plugin — see the header of `lookup_plugins/keepass.py` for how to enable
Browser Integration in KeePassXC. Freshly-flashed Raspberry Pis are reached Browser Integration in KeePassXC. Freshly-flashed Raspberry Pis are reached
first with the OS-default `pi`/`raspberry` credentials (see first with the OS-default `pi`/`raspberry` credentials (see
`roles/pi-standard-setup`), which the role then rotates to a KeePassXC-managed `roles/pi_standard_setup`), which the role then rotates to a KeePassXC-managed
password. password.
## Running a playbook ## Running a playbook

View File

@@ -1,61 +1,63 @@
--- ---
# - hosts: esszimmerradio
#- hosts: esszimmerradio
# roles: # roles:
# - pi-standard-setup # - pi_standard_setup
# - pi-squeezelite-custom # - pi_squeezelite_custom
# - pi-shairport # - pi_shairport
# - pi-lirc # - pi_lirc
# - pi-sispmctl # - pi_sispmctl
# #
- hosts: musikserverwohnzimmeroben - name: Musikserver Wohnzimmer oben
hosts: musikserverwohnzimmeroben
roles: roles:
- pi-standard-setup - pi_standard_setup
- pi-hifiberry-amp - pi_hifiberry_amp
- pi-squeezelite-custom - pi_squeezelite_custom
- pi-shairport - pi_shairport
- pi-irserver - pi_irserver
#- pi-dhtsensor # - pi_dhtsensor
- pi-squeezeserver - pi_squeezeserver
- hosts: kitchenpi - name: Kitchen pi
hosts: kitchenpi
roles: roles:
- pi-standard-setup - pi_standard_setup
- pi-hifiberry-amp - pi_hifiberry_amp
- pi-squeezelite-custom - pi_squeezelite_custom
- pi-shairport - pi_shairport
- pi-lirc - pi_lirc
- pi-dhtsensor - pi_dhtsensor
- pi-disable-onboard-bluetooth - pi_disable_onboard_bluetooth
- bluetooth-monitor - bluetooth_monitor
- hosts: bedroompi - name: Bedroom pi
hosts: bedroompi
roles: roles:
- pi-standard-setup - pi_standard_setup
- pi-squeezelite-custom - pi_squeezelite_custom
- pi-shairport - pi_shairport
- pi-lirc - pi_lirc
- pi-dhtsensor - pi_dhtsensor
- pi-disable-onboard-bluetooth - pi_disable_onboard_bluetooth
- bluetooth-monitor - bluetooth_monitor
- hosts: musicmouse - name: Musicmouse
hosts: musicmouse
roles: roles:
- pi-standard-setup - pi_standard_setup
- pi-hifiberry-amp - pi_hifiberry_amp
- pi-musicmouse - pi_musicmouse
- pi-squeezelite-custom - pi_squeezelite_custom
- pi-shairport - pi_shairport
- pi-lirc - pi_lirc
- bluetooth-monitor - bluetooth_monitor
#- hosts: octopi # - hosts: octopi
# roles: # roles:
# - pi-dhtsensor # - pi_dhtsensor
#- hosts: newrpi # - hosts: newrpi
# roles: # roles:
# - pi-standard-setup # - pi_standard_setup
# - pi-lirc # - pi_lirc

View File

@@ -1,10 +1,10 @@
---
all: all:
hosts: hosts:
server: server:
ansible_host: home.bauer.tech ansible_host: home.bauer.tech
ansible_port: 22187 ansible_port: 22187
server2: server2:
children: children:
iot: iot:
hosts: hosts:
@@ -33,7 +33,7 @@ all:
esszimmerradio: # oben, eltern esszimmerradio: # oben, eltern
squeezelite_name: Esszimmer squeezelite_name: Esszimmer
shairport_name: _Oben_Esszimmer shairport_name: _Oben_Esszimmer
#alsa_card_name: Device # alsa_card_name: Device
squeezeserver: 192.168.178.100 squeezeserver: 192.168.178.100
configure_wifi: true configure_wifi: true
alsa_card_name: 1 alsa_card_name: 1
@@ -76,7 +76,8 @@ all:
squeezeserver: 192.168.178.80 squeezeserver: 192.168.178.80
router_ip: 192.168.178.1 router_ip: 192.168.178.1
home_assistant_url: https://ha.bauer.tech home_assistant_url: https://ha.bauer.tech
home_assistant_token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJkM2QxYjAwYjkxZjY0MWVhYjA4YmZhMDYwYTg3YjRhNyIsImlhdCI6MTcwNDI3MDU5MSwiZXhwIjoyMDE5NjMwNTkxfQ.dzvejgEQd9hf-Yftzd7NkR5pv76GaLFczeOy-a2pa1o home_assistant_token:
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJkM2QxYjAwYjkxZjY0MWVhYjA4YmZhMDYwYTg3YjRhNyIsImlhdCI6MTcwNDI3MDU5MSwiZXhwIjoyMDE5NjMwNTkxfQ.dzvejgEQd9hf-Yftzd7NkR5pv76GaLFczeOy-a2pa1o
configure_wifi: false configure_wifi: false
wifi_ssid: BauerWLAN wifi_ssid: BauerWLAN
my_btmonitor_mqtt_username: my_btmonitor my_btmonitor_mqtt_username: my_btmonitor

View File

@@ -1,8 +1,9 @@
--- ---
- hosts: musicmouse - name: Musicmouse
hosts: musicmouse
roles: roles:
- pi-standard-setup - pi_standard_setup
- pi-hifiberry-amp - pi_hifiberry_amp
- pi-squeezelite - pi_squeezelite
- pi-shairport - pi_shairport
- pi-lirc - pi_lirc

View File

@@ -1,3 +1,5 @@
- hosts: octopi ---
- name: Octopi
hosts: octopi
roles: roles:
- pi-dhtsensor - pi_dhtsensor

View File

@@ -1,18 +1,19 @@
--- ---
- name: Install Debmatic
- hosts: kitchenpi hosts: kitchenpi
tasks: tasks:
- name: Add Key for Debmatic Repository - name: Add Key for Debmatic Repository
apt_key: ansible.builtin.apt_key:
url: https://www.debmatic.de/debmatic/public.key url: https://www.debmatic.de/debmatic/public.key
state: present state: present
- name: Add Debmatic Repository - name: Add Debmatic Repository
ansible.builtin.apt_repository:
repo: deb https://www.debmatic.de/debmatic stable main repo: deb https://www.debmatic.de/debmatic stable main
state: present state: present
filename: debmatic filename: debmatic
- name: Install Pre-requesites - name: Install Pre-requesites
apt: ansible.builtin.apt:
update_cache: yes update_cache: true
name: name:
- build-essential - build-essential
- bison - bison
@@ -21,8 +22,8 @@
- raspberrypi-kernel-headers - raspberrypi-kernel-headers
- pivccu-modules-dkms - pivccu-modules-dkms
- name: Reboot - name: Reboot
reboot: ansible.builtin.reboot:
- name: Install Debmatic package - name: Install Debmatic package
apt: ansible.builtin.apt:
update_cache: no update_cache: false
name: debmatic name: debmatic

View File

@@ -1,7 +0,0 @@
# better-shell-env
Installs preferred CLI tooling (fish, ripgrep, fd-find, neovim, tmux, lsd,
broot, fzf, glances, bat, duf, zoxide) and sets up `oh-my-fish` with the
`bobthefish` theme for `main_user`.
**Key vars:** `main_user`

View File

@@ -1,3 +0,0 @@
function dot -w git -d "Manages dotfiles"
git --git-dir=$HOME/.dot --work-tree=$HOME $argv
end

View File

@@ -1,47 +0,0 @@
---
#
- name: Install packages
apt:
name:
- bat
- broot
- duf
- fd-find
- fish
- fzf
- git
- glances
- lsd
- neovim
- ripgrep
- tmux
- zoxide
# TODO: Dust, btm
block:
become: true
become_user: {{main_user}}
- name: Create bin folder
ansible.builtin.file:
path: ~/bin
state: directory
mode: '0755'
# Oh-my-fish
- name: get oh-my-fish repo
git:
repo: 'https://github.com/oh-my-fish/oh-my-fish.git'
dest: ~/.local/share/git/oh-my-fish
- name: install oh-my-fish
shell:
cmd: "bin/install --offline --noninteractive"
executable: /usr/bin/fish
chdir: ~/.local/share/git/oh-my-fish
creates:
- ~/.local/share/omf
- ~/.config/omf
- copy:
content: "bobthefish"
dst: "~/.config/omf/theme"

View File

@@ -1,22 +0,0 @@
- name: Apt install bluez, firmware and Python requirements
apt:
name:
- bluez
- bluez-firmware
- firmware-realtek
- firmware-realtek-rtl8723cs-bt
- python3-pycryptodome
- python3-bleak
- python3-asyncio-mqtt
- python3-numpy
- name: Copy monitor script
template: src=my_btmonitor.py dest=/usr/bin/my_btmonitor owner=root mode=u+rwx
- name: Install systemd service file
copy: src=my_btmonitor.service dest=/etc/systemd/system/
- name: Add script to autostart and start now
systemd: name=my_btmonitor state=restarted enabled=yes daemon_reload=yes
#- name: Add to sysdweb
# include_role:
# name: pi-sysdweb
# vars:
# sysdweb_name: my_btmonitor

View File

@@ -1,4 +1,4 @@
# bluetooth-monitor # bluetooth_monitor
Installs `my_btmonitor.py` (BLE scanning via `bleak`) as a systemd service Installs `my_btmonitor.py` (BLE scanning via `bleak`) as a systemd service
that watches for nearby devices, publishes state over MQTT, and can restart that watches for nearby devices, publishes state over MQTT, and can restart

View File

@@ -0,0 +1,33 @@
---
- name: Apt install bluez, firmware and Python requirements
ansible.builtin.apt:
name:
- bluez
- bluez-firmware
- firmware-realtek
- firmware-realtek-rtl8723cs-bt
- python3-pycryptodome
- python3-bleak
- python3-asyncio-mqtt
- python3-numpy
- name: Copy monitor script
ansible.builtin.template:
src: my_btmonitor.py
dest: /usr/bin/my_btmonitor
owner: root
mode: u+rwx
- name: Install systemd service file
ansible.builtin.copy:
src: my_btmonitor.service
dest: /etc/systemd/system/
- name: Add script to autostart and start now
ansible.builtin.systemd:
name: my_btmonitor
state: restarted
enabled: "yes"
daemon_reload: "yes"
# - name: Add to sysdweb
# include_role:
# name: pi_sysdweb
# vars:
# sysdweb_name: my_btmonitor

View File

@@ -1,3 +0,0 @@
---
- name: Sync alsa config
template: src=asound.conf dest=/etc/asound.conf

View File

@@ -1,20 +0,0 @@
---
- name: apt install libgpiod2
apt: name=libgpiod2 cache_valid_time=7200 state=present
- name: pip install adafruit-circuitpython-dht
pip:
name: adafruit-circuitpython-dht
executable: pip3
- name: Install script config
template: src=dht22_sensing.json dest=/etc/dht22_sensing.json
- name: Install script
copy: src=dht22_sensing.py dest=/usr/bin/dht22_sensing owner=root mode=u+rwx
- name: Install systemd service file
copy: src=dht22_sensing.service dest=/lib/systemd/system/
- name: Add script to autostart and start now
systemd: name=dht22_sensing state=started enabled=yes daemon_reload=yes
- name: Add to sysdweb
include_role:
name: pi-sysdweb
vars:
sysdweb_name: dht22_sensing

View File

@@ -1,31 +0,0 @@
---
# Use the deprecated version here instead, not the new circuitpython adafruit-circuitpython-dht version
# the new version needs a lot of CPU time and doesn't work correctly on old raspi 1
# a copy of the deprecated repo is downloaded as zip (if it goes away)
- name: Uninstall libgpiod2 (circuitpython) if present
apt: name=libgpiod2 cache_valid_time=7200 state=absent
- name: pip uninstall adafruit-circuitpython-dht
pip:
name: adafruit-circuitpython-dht
executable: pip3
state: absent
extra_args: "--break-system-packages"
- name: pip install adafruit-dht
pip:
name: adafruit-dht
executable: pip3
extra_args: "--break-system-packages"
- name: Install script config
template: src=dht22_sensing.json dest=/etc/dht22_sensing.json
- name: Install script
copy: src=dht22_sensing.py dest=/usr/bin/dht22_sensing owner=root mode=u+rwx
- name: Install systemd service file
copy: src=dht22_sensing.service dest=/etc/systemd/system/
- name: Add script to autostart and start now
systemd: name=dht22_sensing state=restarted enabled=yes daemon_reload=yes
- name: Add to sysdweb
include_role:
name: pi-sysdweb
vars:
sysdweb_name: dht22_sensing

View File

@@ -1,4 +0,0 @@
---
- name: reboot
reboot:

View File

@@ -1,4 +0,0 @@
---
- name: reboot
reboot:

View File

@@ -1,3 +0,0 @@
---
dependencies:
- role: pi-alsasetup

View File

@@ -1,16 +0,0 @@
---
- name: Copy irserver
copy: src=irserver dest=/usr/bin/irserver mode=u+rx
- name: Make config dir for remotes
file: path=/usr/bin/remotes state=directory
- name: Copy hauppauge remote
copy: src=hauppauge.rem dest=/usr/bin/remotes/
- name: Copy irserver systemd file
copy: src=irserver.service dest=/lib/systemd/system/
- name: Enable irserver autostart
systemd: name=irserver state=restarted enabled=yes daemon_reload=yes
- name: Add irserver to sysdweb
include_role:
name: pi-sysdweb
vars:
sysdweb_name: irserver

View File

@@ -1,26 +0,0 @@
---
- name: Install lirc
apt:
name: lirc
- name: Install config file lirc_options.conf
copy: src=lirc_options.conf dest=/etc/lirc/lirc_options.conf
- name: Install config file lircd.conf
copy: src=lircd.conf dest=/etc/lirc/lircd.conf
- name: Install remote file
copy: src=hauppauge.conf dest=/etc/lirc/hauppauge.conf
- name: Activate overlay in boot config
lineinfile:
path: /boot/firmware/config.txt
regexp: "^#?dtoverlay=gpio-ir"
line: "dtoverlay=gpio-ir,gpio_pin=17"
register: boot_overlay
- name: Restart lircd
systemd: name=lircd state=started enabled=yes daemon_reload=yes
- name: Reboot if boot overlay changed
reboot:
when: boot_overlay.changed
- name: Add to sysdweb
include_role:
name: pi-sysdweb
vars:
sysdweb_name: lircd

View File

@@ -1,40 +0,0 @@
general:
alsa_device: softvol_effects
mqtt:
user: musicmouse
password: KNLEFLZF94yA6Zhj141
server: homeassistant
hass_url: https://ha.bauer.tech
hass_token: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiI4N2ExMzM2ZmQ4ZWQ0ZDgzOWZhMjU3NmZjYTg1NWQ1ZiIsImlhdCI6MTcwNDAyOTUyOSwiZXhwIjoyMDE5Mzg5NTI5fQ.vx9L5bTSey98uc8TwodShaEXSMr-hjXugPsNviR_fEw"
button_leds_brightness: 0.5
volume_increment: 5
min_volume: 23
max_volume: 70
serial_port: "/dev/ttyUSB0"
figures:
elefant:
id: "88041174e9"
colors: ["#ffff00", "#00c8ff", "#094b46", "#c20099"]
fuchs:
id: "8804ce7230"
colors: ["#F4D35E", "#F95738", "#F95738", "#083d77"]
eule:
id: "88040d71f0"
colors: ["#e5a200", "#f8e300", "w33", "w99"]
omnom:
id: "88043c6ede"
colors: ["#005102", "#fec800", "#005102", "#3bc405"]
eichhoernchen:
id: "88040b78ff"
colors: ["#ff0ada", "#4BC6B9", "#69045a", "#4BC6B9"]
hund:
id: "8804bc7444"
colors: ["#ffff00", "#00c8ff", "#094b46", "#c20099"]
hase:
id: "88044670ba"
colors: ["#ffff00", "#00c8ff", "#094b46", "#c20099"]
schneemann:
id: "88043f71c2"
colors: ["#ff0ada", "#4BC6B9", "#69045a", "#4BC6B9"]

View File

@@ -1,3 +0,0 @@
---
shairport_sync_version: "3.3.5"
shairport_name: Unnamed Raspberry with shairport

View File

@@ -1,3 +0,0 @@
---
dependencies:
- role: pi-alsasetup

View File

@@ -1,21 +0,0 @@
---
- name: Check if sispmctl already exists
stat: path=/usr/bin/sispmctl
register: sispmctl_file
- name: Install dependencies
apt: name="libusb-dev" cache_valid_time=7200 state=present
- name: Copy sispmctl sources
unarchive: src=sispmctl-4.7.tar.gz dest=/tmp
when: sispmctl_file.stat.exists == false
- name: Build and install
shell: cd /tmp/sispmctl*/ && ./configure --prefix=/usr && make install
when: sispmctl_file.stat.exists == false
- name: Install systemd service file
copy: src=sispmctl.service dest=/lib/systemd/system/
- name: Add script to autostart and start now
systemd: name=sispmctl state=started enabled=yes daemon_reload=yes
- name: Add to sysdweb
include_role:
name: pi-sysdweb
vars:
sysdweb_name: sispmctl

View File

@@ -1,31 +0,0 @@
---
- name: Uninstall system package of squeezelite
apt: name=squeezelite state=absent
- name: Install dependencies
apt:
name:
- libmad0
- libmpg123-0
- libflac12
- libvorbisfile3
- libfaad2
# for building libssl-dev, libasound2-dev, libflac-dev, libvorbis-dev, libsoxr-dev, libfaad-dev, libmad0-dev, libmpg123-dev
state: present
cache_valid_time: 7200
- name: Remove old config file if present
file: path=/etc/default/squeezelite state=absent
- name: Copy over custom compile version of squeezelite
copy: src=squeezelite dest=/opt/squeezelite mode=700
- name: Install systemd service file
template: src=squeezelite.service dest=/lib/systemd/system/
- name: Enable sysdweb autostart
systemd: name=squeezelite state=restarted enabled=yes daemon_reload=yes
- name: Add to sysdweb
include_role:
name: pi-sysdweb
vars:
sysdweb_name: squeezelite
# build with adapted Makefile.rpi:
#OPTS = -DRESAMPLE -DDSD -DUSE_SSL -DLINKALL -I./include -I./include/opus -I./include/alac -I/usr/local/include -s -mfpu=vfp -mfloat-abi=hard -march=armv6zk -mtune=arm1176jzf-s

View File

@@ -1,2 +0,0 @@
---
squeezeserver: 192.168.178.80

View File

@@ -1,3 +0,0 @@
---
- name: restart-squeezelite
systemd: name=squeezelite state=restarted enabled=yes daemon_reload=yes

View File

@@ -1,3 +0,0 @@
---
dependencies:
- role: pi-alsasetup

View File

@@ -1,13 +0,0 @@
---
- name: Apt install squeezelite package
apt: name=squeezelite cache_valid_time=7200 state=present
notify: restart-squeezelite
- name: Install config file
template: src=squeezelite.cfg dest=/etc/default/squeezelite
notify: restart-squeezelite
- name: Add to sysdweb
include_role:
name: pi-sysdweb
vars:
sysdweb_name: squeezelite

View File

@@ -1,13 +0,0 @@
---
wifi_ssid: "" # put SSID here to configure wifi
ansible_user: "root" # "User to connect with, put in 'pi' here if you connect the first time, else leave empty"
new_hostname: "" # set this to change the hostname
timezone: "Europe/Berlin"
wifi_country: "DE"
wifi_pass_url: "bauer_wifi" # has to be in keepass with url "wifi_pass_url"
ansible_ssh_pass: "raspberry"
ansible_become_password: "raspberry"
ansible_become: yes

View File

@@ -1,8 +0,0 @@
---
- name: restart sshd
service:
name: sshd
state: restarted
- name: reboot
reboot:

View File

@@ -1,102 +0,0 @@
---
- name: Do apt update/upgrade
apt: upgrade=yes update_cache=yes cache_valid_time=7200
- name: Detect Raspi Model
slurp: src=/sys/firmware/devicetree/base/model
register: raspberry_model
- name: Show Raspi Model
debug: msg={{ raspberry_model.content | b64decode }}
- name: Add authorized SSH key to root account
authorized_key:
user: root
key: "{{ lookup('file', 'sshkey.pub') }}"
state: present
- name: Activate root login with key
lineinfile:
path: /etc/ssh/sshd_config
regexp: "^#?PermitRootLogin"
line: "PermitRootLogin prohibit-password"
notify: restart sshd
- name: Deactive SSH accepting locale vars (leads to warnings)
lineinfile:
path: /etc/ssh/sshd_config
regexp: "^#?AcceptEnv LANG LC_*"
line: "#AcceptEnv LANG LC_*"
notify: restart sshd
- name: Get hostname
command: "raspi-config nonint get_hostname"
register: pi_hostname
changed_when: False
- name: Change hostname {{ new_hostname }}
command: "raspi-config nonint do_hostname {{ new_hostname }}"
when: new_hostname | bool and pi_hostname.stdout != new_hostname
register: set_hostname
notify: reboot
- name: Get hostname
command: "raspi-config nonint get_hostname"
register: pi_hostname
changed_when: False
- name: set boot mode to CLI
command: "raspi-config nonint do_boot_behaviour B1"
#I2 Change Timezone
- name: Change timezone
command: "raspi-config nonint do_change_timezone {{ timezone }}"
- name: Change locale
command: "raspi-config nonint do_change_locale en_US.UTF-8"
- name: Change password of default pi account
user:
name: pi
update_password: always
password: "{{ lookup('keepass', 'ansible://default_rpi_password') | password_hash('sha512') }}"
- name: Install Packages (vim, git, basic python stuff)
apt:
name:
- vim
- git
- python3
- python3-pip
- python3-wheel
- telnet
cache_valid_time: 7200
state: present
- name: Copy vim config
copy: src=vimrc dest=/root/.vimrc
- name: Copy git config
copy: src=gitconfig dest=/root/.gitconfig
# Wifi
- name: Get WiFi country
command: "raspi-config nonint get_wifi_country"
register: wifi_country
changed_when: False
ignore_errors: yes #to avoid error when WiFi is not present
- name: Change WiFi country
command: "raspi-config nonint do_wifi_country {{ wifi_country }}"
when: configure_wifi
- name: Set WiFi credentials
command: "raspi-config nonint do_wifi_ssid_passphrase {{ wifi_ssid }} {{ lookup('keepass', 'bauer_wifi') }}"
when: configure_wifi
- name: Install watchdog
apt: name=watchdog cache_valid_time=7200 state=present
when: not wifi_ssid is defined
- name: Configure watchdog
blockinfile:
path: /etc/watchdog.conf
block: |
interface = wlan0
retry-timeout = 90
ping = {{router_ip}}
interval = 15
when: configure_wifi
- name: Start watchdog
systemd: name=watchdog state=started enabled=yes daemon_reload=yes # state=restarted not working, also not manually
when: configure_wifi
# Message of the day
- name: Set Message of the day
copy: src=motd/{{ pi_hostname.stdout }} dest=/etc/motd
# LED off script
- name: Copy led off script
copy: src=raspi-leds-off.sh dest=/usr/sbin/raspi-leds-off.sh mode="u+rwx"
- name: Copy led off service
copy: src=raspi-leds-off.service dest=/lib/systemd/system/
- name: Activate led off servic
systemd: name=raspi-leds-off state=restarted enabled=yes daemon_reload=yes

View File

@@ -1,3 +1,3 @@
# pi-alsasetup # pi_alsasetup
Syncs the ALSA configuration file to the host. Syncs the ALSA configuration file to the host.

View File

@@ -0,0 +1,5 @@
---
- name: Sync alsa config
ansible.builtin.template:
src: asound.conf
dest: /etc/asound.conf

View File

@@ -1,7 +1,7 @@
# pi-dhtsensor # pi_dhtsensor
Installs the DHT22 temperature/humidity sensor polling script based on the Installs the DHT22 temperature/humidity sensor polling script based on the
legacy `Adafruit_DHT` library (removing the circuitpython variant/ legacy `Adafruit_DHT` library (removing the circuitpython variant/
`libgpiod2` if present — mutually exclusive with `pi-dhtsensor-circuitpython`). `libgpiod2` if present — mutually exclusive with `pi_dhtsensor_circuitpython`).
**Key vars:** `dht_pin`, `dht_polling_sleep_time_seconds` **Key vars:** `dht_pin`, `dht_polling_sleep_time_seconds`

View File

@@ -0,0 +1,46 @@
---
# Use the deprecated version here instead, not the new circuitpython adafruit-circuitpython-dht version
# the new version needs a lot of CPU time and doesn't work correctly on old raspi 1
# a copy of the deprecated repo is downloaded as zip (if it goes away)
- name: Uninstall libgpiod2 (circuitpython) if present
ansible.builtin.apt:
name: libgpiod2
cache_valid_time: "7200"
state: absent
- name: Pip uninstall adafruit-circuitpython-dht
ansible.builtin.pip:
name: adafruit-circuitpython-dht
executable: pip3
state: absent
extra_args: "--break-system-packages"
- name: Pip install adafruit-dht
ansible.builtin.pip:
name: adafruit-dht
executable: pip3
extra_args: "--break-system-packages"
- name: Install script config
ansible.builtin.template:
src: dht22_sensing.json
dest: /etc/dht22_sensing.json
- name: Install script
ansible.builtin.copy:
src: dht22_sensing.py
dest: /usr/bin/dht22_sensing
owner: root
mode: u+rwx
- name: Install systemd service file
ansible.builtin.copy:
src: dht22_sensing.service
dest: /etc/systemd/system/
- name: Add script to autostart and start now
ansible.builtin.systemd:
name: dht22_sensing
state: restarted
enabled: "yes"
daemon_reload: "yes"
- name: Add to sysdweb
ansible.builtin.include_role:
name: pi_sysdweb
vars:
sysdweb_name: dht22_sensing

View File

@@ -1,8 +1,8 @@
# pi-dhtsensor-circuitpython # pi_dhtsensor_circuitpython
Installs the DHT22 temperature/humidity sensor polling script based on Installs the DHT22 temperature/humidity sensor polling script based on
`adafruit-circuitpython-dht` (requires `libgpiod2`) — the newer alternative `adafruit-circuitpython-dht` (requires `libgpiod2`) — the newer alternative
to the `pi-dhtsensor` role's legacy `Adafruit_DHT` library. Mutually to the `pi_dhtsensor` role's legacy `Adafruit_DHT` library. Mutually
exclusive with `pi-dhtsensor`. exclusive with `pi_dhtsensor`.
**Key vars:** `dht_pin`, `dht_polling_sleep_time_seconds` **Key vars:** `dht_pin`, `dht_polling_sleep_time_seconds`

View File

@@ -0,0 +1,35 @@
---
- name: Apt install libgpiod2
ansible.builtin.apt:
name: libgpiod2
cache_valid_time: "7200"
state: present
- name: Pip install adafruit-circuitpython-dht
ansible.builtin.pip:
name: adafruit-circuitpython-dht
executable: pip3
- name: Install script config
ansible.builtin.template:
src: dht22_sensing.json
dest: /etc/dht22_sensing.json
- name: Install script
ansible.builtin.copy:
src: dht22_sensing.py
dest: /usr/bin/dht22_sensing
owner: root
mode: u+rwx
- name: Install systemd service file
ansible.builtin.copy:
src: dht22_sensing.service
dest: /lib/systemd/system/
- name: Add script to autostart and start now
ansible.builtin.systemd:
name: dht22_sensing
state: started
enabled: "yes"
daemon_reload: "yes"
- name: Add to sysdweb
ansible.builtin.include_role:
name: pi_sysdweb
vars:
sysdweb_name: dht22_sensing

View File

@@ -1,4 +1,4 @@
# pi-disable-onboard-bluetooth # pi_disable_onboard_bluetooth
Disables the Pi's onboard Bluetooth radio via `dtoverlay=disable-bt` in the Disables the Pi's onboard Bluetooth radio via `dtoverlay=disable-bt` in the
boot config, for hosts that use an external BT/audio dongle instead. boot config, for hosts that use an external BT/audio dongle instead.

View File

@@ -0,0 +1,3 @@
---
- name: Reboot
ansible.builtin.reboot:

View File

@@ -1,7 +1,7 @@
--- ---
- name: Deactivate onboard bluetooth - name: Deactivate onboard bluetooth
lineinfile: ansible.builtin.lineinfile:
path: /boot/firmware/config.txt path: /boot/firmware/config.txt
regexp: "^#?dtoverlay=disable-bt" regexp: "^#?dtoverlay=disable-bt"
line: "dtoverlay=disable-bt" line: "dtoverlay=disable-bt"
notify: reboot notify: Reboot

View File

@@ -1,4 +1,4 @@
# pi-hifiberry-amp # pi_hifiberry_amp
Deactivates the Pi's onboard analog audio and activates a HiFiBerry Deactivates the Pi's onboard analog audio and activates a HiFiBerry
amp/DAC overlay instead. amp/DAC overlay instead.

View File

@@ -0,0 +1,3 @@
---
- name: Reboot
ansible.builtin.reboot:

View File

@@ -0,0 +1,3 @@
---
dependencies:
- role: pi_alsasetup

View File

@@ -1,13 +1,13 @@
--- ---
- name: Deactivate normal audio - name: Deactivate normal audio
lineinfile: ansible.builtin.lineinfile:
path: /boot/config.txt path: /boot/config.txt
regexp: "^#?dtparam=audio=on" regexp: "^#?dtparam=audio=on"
line: "#dtparam=audio=on" line: "#dtparam=audio=on"
notify: reboot notify: Reboot
- name: Activate Hifiberry - name: Activate Hifiberry
lineinfile: ansible.builtin.lineinfile:
path: /boot/firmware/config.txt path: /boot/firmware/config.txt
regexp: "^#?dtoverlay=hifiberry-amp" regexp: "^#?dtoverlay=hifiberry-amp"
line: "dtoverlay={{hifiberry_overlay}}" line: "dtoverlay={{ hifiberry_overlay }}"
notify: reboot notify: Reboot

View File

@@ -1,5 +1,5 @@
# pi-irserver # pi_irserver
Installs and configures `irserver` (with a Hauppauge remote config) as an Installs and configures `irserver` (with a Hauppauge remote config) as an
autostarted systemd service for IR remote control, and registers it with autostarted systemd service for IR remote control, and registers it with
`pi-sysdweb`. `pi_sysdweb`.

View File

@@ -0,0 +1,29 @@
---
- name: Copy irserver
ansible.builtin.copy:
src: irserver
dest: /usr/bin/irserver
mode: u+rx
- name: Make config dir for remotes
ansible.builtin.file:
path: /usr/bin/remotes
state: directory
- name: Copy hauppauge remote
ansible.builtin.copy:
src: hauppauge.rem
dest: /usr/bin/remotes/
- name: Copy irserver systemd file
ansible.builtin.copy:
src: irserver.service
dest: /lib/systemd/system/
- name: Enable irserver autostart
ansible.builtin.systemd:
name: irserver
state: restarted
enabled: "yes"
daemon_reload: "yes"
- name: Add irserver to sysdweb
ansible.builtin.include_role:
name: pi_sysdweb
vars:
sysdweb_name: irserver

View File

@@ -1,4 +1,4 @@
# pi-lirc # pi_lirc
Installs and configures LIRC (Linux Infrared Remote Control): package, Installs and configures LIRC (Linux Infrared Remote Control): package,
`lirc_options.conf`, `lircd.conf`, a remote definition file, and the `lirc_options.conf`, `lircd.conf`, a remote definition file, and the

View File

@@ -0,0 +1,36 @@
---
- name: Install lirc
ansible.builtin.apt:
name: lirc
- name: Install config file lirc_options.conf
ansible.builtin.copy:
src: lirc_options.conf
dest: /etc/lirc/lirc_options.conf
- name: Install config file lircd.conf
ansible.builtin.copy:
src: lircd.conf
dest: /etc/lirc/lircd.conf
- name: Install remote file
ansible.builtin.copy:
src: hauppauge.conf
dest: /etc/lirc/hauppauge.conf
- name: Activate overlay in boot config
ansible.builtin.lineinfile:
path: /boot/firmware/config.txt
regexp: "^#?dtoverlay=gpio-ir"
line: "dtoverlay=gpio-ir,gpio_pin=17"
register: boot_overlay
- name: Restart lircd
ansible.builtin.systemd:
name: lircd
state: started
enabled: "yes"
daemon_reload: "yes"
- name: Reboot if boot overlay changed
ansible.builtin.reboot:
when: boot_overlay.changed
- name: Add to sysdweb
ansible.builtin.include_role:
name: pi_sysdweb
vars:
sysdweb_name: lircd

View File

@@ -1,4 +1,4 @@
# pi-musicmouse # pi_musicmouse
Deploys the "Musicmouse" application: checks out its git repo, creates a Deploys the "Musicmouse" application: checks out its git repo, creates a
Python virtualenv, sets up a media directory, and installs its config file. Python virtualenv, sets up a media directory, and installs its config file.

View File

@@ -0,0 +1,40 @@
---
general:
alsa_device: softvol_effects
mqtt:
user: musicmouse
password: KNLEFLZF94yA6Zhj141
server: homeassistant
hass_url: https://ha.bauer.tech
hass_token: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiI4N2ExMzM2ZmQ4ZWQ0ZDgzOWZhMjU3NmZjYTg1NWQ1ZiIsImlhdCI6MTcwNDAyOTUyOSwiZXhwIjoyMDE5Mzg5NTI5fQ.vx9L5bTSey98uc8TwodShaEXSMr-hjXugPsNviR_fEw" # noqa: yaml[line-length]
button_leds_brightness: 0.5
volume_increment: 5
min_volume: 23
max_volume: 70
serial_port: "/dev/ttyUSB0"
figures:
elefant:
id: "88041174e9"
colors: ["#ffff00", "#00c8ff", "#094b46", "#c20099"]
fuchs:
id: "8804ce7230"
colors: ["#F4D35E", "#F95738", "#F95738", "#083d77"]
eule:
id: "88040d71f0"
colors: ["#e5a200", "#f8e300", "w33", "w99"]
omnom:
id: "88043c6ede"
colors: ["#005102", "#fec800", "#005102", "#3bc405"]
eichhoernchen:
id: "88040b78ff"
colors: ["#ff0ada", "#4BC6B9", "#69045a", "#4BC6B9"]
hund:
id: "8804bc7444"
colors: ["#ffff00", "#00c8ff", "#094b46", "#c20099"]
hase:
id: "88044670ba"
colors: ["#ffff00", "#00c8ff", "#094b46", "#c20099"]
schneemann:
id: "88043f71c2"
colors: ["#ff0ada", "#4BC6B9", "#69045a", "#4BC6B9"]

View File

@@ -1,6 +1,6 @@
--- ---
- name: Packages - name: Packages
apt: ansible.builtin.apt:
name: name:
- python3 - python3
- python3-pip - python3-pip
@@ -8,9 +8,9 @@
- samba - samba
- name: Checkout Musicmouse repo - name: Checkout Musicmouse repo
ansible.builtin.git: ansible.builtin.git:
repo: 'ssh://git@git.bauer.tech:2222/martin/musicmouse.git' repo: "ssh://git@git.bauer.tech:2222/martin/musicmouse.git"
dest: '/opt/musicmouse' dest: "/opt/musicmouse"
version: 'release/1.1' version: "release/1.1"
accept_hostkey: true accept_hostkey: true
- name: Create and update virtual env - name: Create and update virtual env
ansible.builtin.pip: ansible.builtin.pip:
@@ -18,19 +18,32 @@
virtualenv: /opt/musicmouse_venv virtualenv: /opt/musicmouse_venv
virtualenv_command: "/usr/bin/python3 -m venv" virtualenv_command: "/usr/bin/python3 -m venv"
- name: Create media directory - name: Create media directory
file: ansible.builtin.file:
path: /media/musicmouse path: /media/musicmouse
state: directory state: directory
- name: Install config file - name: Install config file
copy: src=config.yml dest=/media/musicmouse/config.yml ansible.builtin.copy:
src: config.yml
dest: /media/musicmouse/config.yml
- name: Install systemd service file - name: Install systemd service file
copy: src=musicmouse.service dest=/etc/systemd/system/ ansible.builtin.copy:
src: musicmouse.service
dest: /etc/systemd/system/
- name: Add script to autostart and start now - name: Add script to autostart and start now
systemd: name=musicmouse state=restarted enabled=yes daemon_reload=yes ansible.builtin.systemd:
name: musicmouse
state: restarted
enabled: "yes"
daemon_reload: "yes"
- name: Samba setup - name: Samba setup
copy: src=smb.conf dest=/etc/samba/ ansible.builtin.copy:
src: smb.conf
dest: /etc/samba/
- name: Restart samba - name: Restart samba
systemd: name=smbd state=restarted enabled=yes ansible.builtin.systemd:
name: smbd
state: restarted
enabled: "yes"
# manual steps: # manual steps:
# - set samba passwords with smbpasswd # - set samba passwords with smbpasswd
# - copy music into /media/musicmouse (or via samba share) # - copy music into /media/musicmouse (or via samba share)

View File

@@ -1,4 +1,4 @@
# pi-shairport # pi_shairport
Builds and installs shairport-sync (AirPlay receiver) from source, copies Builds and installs shairport-sync (AirPlay receiver) from source, copies
its config, and patches the systemd service to run as root. its config, and patches the systemd service to run as root.

View File

@@ -0,0 +1,3 @@
---
shairport_sync_version: "3.3.5"
shairport_name: Unnamed Raspberry with shairport

View File

@@ -0,0 +1,3 @@
---
dependencies:
- role: pi_alsasetup

View File

@@ -1,6 +1,6 @@
--- ---
- name: Apt install dependencies - name: Apt install dependencies
apt: ansible.builtin.apt:
cache_valid_time: 7200 cache_valid_time: 7200
state: present state: present
name: name:
@@ -18,21 +18,26 @@
- libssl-dev - libssl-dev
- libsoxr-dev - libsoxr-dev
- name: Build and Install Shairport sync (may take a while) - name: Build and Install Shairport sync (may take a while)
script: "build-shairport-sync.sh ${shairport_sync_version}" ansible.builtin.script: "build-shairport-sync.sh ${shairport_sync_version}"
args: args:
creates: /usr/local/bin/shairport-sync creates: /usr/local/bin/shairport-sync
- name: Copy config - name: Copy config
template: src=shairport-sync.conf dest=/etc/shairport-sync.conf ansible.builtin.template:
src: shairport-sync.conf
dest: /etc/shairport-sync.conf
- name: Modify service file to run as root - name: Modify service file to run as root
lineinfile: ansible.builtin.lineinfile:
path: /lib/systemd/system/shairport-sync.service path: /lib/systemd/system/shairport-sync.service
regexp: "^#?User=" regexp: "^#?User="
line: "User=root" line: "User=root"
- name: Restart shairport-sync - name: Restart shairport-sync
systemd: name=shairport-sync state=restarted enabled=yes daemon_reload=yes ansible.builtin.systemd:
name: shairport-sync
state: restarted
enabled: "yes"
daemon_reload: "yes"
- name: Add to sysdweb - name: Add to sysdweb
include_role: ansible.builtin.include_role:
name: pi-sysdweb name: pi_sysdweb
vars: vars:
sysdweb_name: shairport-sync sysdweb_name: shairport-sync

View File

@@ -1,4 +1,4 @@
# pi-sispmctl # pi_sispmctl
Builds and installs `sispmctl` (controls Gembird SIS-PM controllable power Builds and installs `sispmctl` (controls Gembird SIS-PM controllable power
strips) from source and runs it as an autostarted systemd service. strips) from source and runs it as an autostarted systemd service.

Some files were not shown because too many files have changed in this diff Show More