Rename mqtt-internal to mqtt
This commit is contained in:
parent
44a122575d
commit
e7e2458ba0
8 changed files with 2 additions and 2 deletions
1
roles/mqtt/defaults/main.yaml
Normal file
1
roles/mqtt/defaults/main.yaml
Normal file
|
@ -0,0 +1 @@
|
|||
mqtt_bambulab_cafile: /etc/mosquitto/ca_certificates/bambulab.pem
|
8
roles/mqtt/handlers/main.yaml
Normal file
8
roles/mqtt/handlers/main.yaml
Normal file
|
@ -0,0 +1,8 @@
|
|||
---
|
||||
- ansible.builtin.import_tasks:
|
||||
file: ../../common/handlers/main.yaml
|
||||
|
||||
- name: restart mosquitto
|
||||
ansible.builtin.systemd:
|
||||
name: mosquitto
|
||||
state: restarted
|
32
roles/mqtt/tasks/main.yaml
Normal file
32
roles/mqtt/tasks/main.yaml
Normal file
|
@ -0,0 +1,32 @@
|
|||
---
|
||||
|
||||
- name: Install dependencies
|
||||
ansible.builtin.apt:
|
||||
name:
|
||||
- mosquitto
|
||||
- avahi-daemon
|
||||
|
||||
- name: Install bambulab cafile
|
||||
# openssl s_client -showcerts -connect <ip>:8883 </dev/null | sed -n -e '/-.BEGIN/,/-.END/ p'
|
||||
ansible.builtin.copy:
|
||||
dest: "{{ mqtt_bambulab_cafile }}"
|
||||
content: "{{ lookup('passwordstore', 'bambulab subkey=cafile') }}"
|
||||
|
||||
- name: Configure Mosquitto
|
||||
ansible.builtin.template:
|
||||
src: "{{ item }}"
|
||||
dest: "/etc/mosquitto/conf.d/{{ item }}"
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
notify: restart mosquitto
|
||||
with_items:
|
||||
- bambulab.conf
|
||||
- internal.conf
|
||||
- public-bridge.conf
|
||||
|
||||
- name: Start mosquitto
|
||||
ansible.builtin.systemd:
|
||||
name: mosquitto
|
||||
state: started
|
||||
enabled: yes
|
10
roles/mqtt/templates/bambulab.conf
Normal file
10
roles/mqtt/templates/bambulab.conf
Normal file
|
@ -0,0 +1,10 @@
|
|||
# {{ ansible_managed }}
|
||||
|
||||
connection bambulab
|
||||
address {{ lookup('passwordstore', 'bambulab subkey=host') }}:8883
|
||||
bridge_cafile {{ mqtt_bambulab_cafile }}
|
||||
bridge_insecure true
|
||||
remote_username bblp
|
||||
remote_password {{ lookup('passwordstore', 'bambulab subkey=key') }}
|
||||
|
||||
topic # in 2 bambulab/ ""
|
6
roles/mqtt/templates/internal.conf
Normal file
6
roles/mqtt/templates/internal.conf
Normal file
|
@ -0,0 +1,6 @@
|
|||
# {{ ansible_managed }}
|
||||
|
||||
listener 1883 ::
|
||||
listener 1883 0.0.0.0
|
||||
|
||||
allow_anonymous true
|
21
roles/mqtt/templates/public-bridge.conf
Normal file
21
roles/mqtt/templates/public-bridge.conf
Normal file
|
@ -0,0 +1,21 @@
|
|||
# {{ ansible_managed }}
|
||||
|
||||
connection public-bridge
|
||||
address {{ mqtt_public_host }}
|
||||
|
||||
topic bambulab/# out
|
||||
topic bitlair/alarm out
|
||||
topic bitlair/climate/# out
|
||||
topic bitlair/collectd/bitlair-5406/snmp/# out
|
||||
topic bitlair/collectd/apc_powerbar/snmp/current out
|
||||
topic bitlair/doorduino/lockstate out
|
||||
topic bitlair/entrysensor/# out
|
||||
topic bitlair/lasercutter/+ out
|
||||
topic bitlair/music/+/state out
|
||||
topic bitlair/music/+/volume out
|
||||
topic bitlair/photos out
|
||||
topic bitlair/pos/product out
|
||||
topic bitlair/power/# out
|
||||
topic bitlair/state out
|
||||
topic bitlair/state/djo out
|
||||
topic bitlair/wifi/+/online out
|
Loading…
Add table
Add a link
Reference in a new issue