Add mqtt-tail script to adm hosts

This commit is contained in:
Timo Makinen 2025-04-05 16:35:24 +00:00
parent 776b562abe
commit 95c66d976f

View file

@ -53,6 +53,7 @@
- libvirt-client # kvm host client - libvirt-client # kvm host client
- make # generic building - make # generic building
- mariadb # mariadb client tools - mariadb # mariadb client tools
- mosquitto # mqtt reading
- nano # more editors - nano # more editors
- nmap # check for open ports - nmap # check for open ports
- nsd # check dns zone files - nsd # check dns zone files
@ -113,3 +114,27 @@
state: link state: link
owner: root owner: root
group: "{{ ansible_wheel }}" group: "{{ ansible_wheel }}"
- name: Add mqtt-tail script
ansible.builtin.copy:
dest: /usr/local/bin/mqtt-tail
content: |
#!/bin/sh
set -eu
if [ -n "${1:-}" ]; then
topic="$1"
shift
else
topic="#"
fi
if [ $# -ne 0 ]; then
echo "Usage: $(basename "$0") [topic]" 1>&2
exit 1
fi
exec mosquitto_sub -h mqtt02.home.foo.sh -v -t "$topic" \
--cafile "{{ tls_certs }}/ca.crt" \
--cert "{{ tls_certs }}/{{ inventory_hostname }}.crt" \
--key "{{ tls_private }}/{{ inventory_hostname }}.key" \
mode: "0755"
owner: root
group: "{{ ansible_wheel }}"