2
0
mirror of https://github.com/schnidrig/openhab-ansible synced 2026-01-12 00:48:46 +01:00

some clean ups

This commit is contained in:
Christian Schnidrig
2021-03-01 08:59:54 +01:00
parent 7bccead600
commit acae0432c8
10 changed files with 0 additions and 234 deletions

View File

@@ -1,5 +0,0 @@
---
- name: restart mqttwarn
service: name=mqttwarn state=restarted

View File

@@ -1,8 +0,0 @@
---
- include: mosquitto.yml
tags:
- mosquitto
- include: mqttwarn.yml
tags:
- mqttwarn

View File

@@ -1,12 +0,0 @@
---
- name: install mosquitto packages
apt:
pkg:
- mosquitto
- mosquitto-clients
update_cache: "{{apt_config.update_cache}}"
cache_valid_time: "{{apt_config.cache_valid_time}}"

View File

@@ -1,50 +0,0 @@
---
- name: install packages
apt:
pkg:
- python3-paho-mqtt
update_cache: "{{apt_config.update_cache}}"
cache_valid_time: "{{apt_config.cache_valid_time}}"
- name: install mqttwarn
vars:
ansible_python_interpreter: /usr/bin/python3
pip:
name: mqttwarn
- name: install config file
template:
src: mqttwarn.ini
dest: "/etc/mqttwarn.ini"
owner: root
group: root
mode: "u=rw,g=r,o=r"
notify: restart mqttwarn
tags:
- mqttwarnconfig
- name: create log dir
file:
dest: "/var/log/mqttwarn"
state: directory
owner: pi
group: pi
- name: install service file
template:
src: mqttwarn.service
dest: "/etc/systemd/system/mqttwarn.service"
owner: root
group: root
mode: "u=rw,g=r,o=r"
notify: restart mqttwarn
- name: "configure systemd"
systemd:
name: mqttwarn
daemon_reload: yes
enabled: true
state: started

View File

@@ -1,59 +0,0 @@
---
- name: install packages
apt:
pkg:
- python-paho-mqtt
- python3-paho-mqtt
update_cache: "{{apt_config.update_cache}}"
cache_valid_time: "{{apt_config.cache_valid_time}}"
- git:
repo: "https://github.com/jpmens/mqttwarn.git"
dest: "/opt/mqttwarn"
version: "0.10.4"
#version: "0c030a94a7e3590ea3485f460be555cee027d8a8"
tags:
- mqttwarn
- name: install config file
template:
src: mqttwarn.ini
dest: "/opt/mqttwarn/mqttwarn.ini"
owner: root
group: root
mode: "u=rw,g=r,o=r"
notify: restart mqttwarn
tags:
- mqttwarn
- mqttwarnconfig
- name: create log dir
file:
dest: "/var/log/mqttwarn"
state: directory
owner: pi
group: pi
tags:
- mqttwarn
- name: install service file
template:
src: mqttwarn.service
dest: "/etc/systemd/system/mqttwarn.service"
owner: root
group: root
mode: "u=rw,g=r,o=r"
tags:
- mqttwarn
- name: "configure systemd"
systemd:
name: mqttwarn
daemon_reload: yes
enabled: true
state: started
tags:
- mqttwarn

View File

@@ -1,49 +0,0 @@
[defaults]
hostname = 'localhost'
port = 1883
clientid = 'mqttwarn'
; logging
logformat = '%(asctime)-15s %(levelname)-5s [%(module)s] %(message)s'
logfile = '/var/log/mqttwarn/mqttwarn.log'
; one of: CRITICAL, DEBUG, ERROR, INFO, WARN
loglevel = INFO
; name the service providers you will be using.
launch = file, log, carbon
[config:file]
append_newline = True
targets = {
'f01' : ['/tmp/f.01'],
'log-me' : ['/tmp/log.me'],
'mqttwarn' : ['/tmp/mqttwarn.err'],
}
[config:log]
targets = {
'debug' : [ 'debug' ],
'info' : [ 'info' ],
'warn' : [ 'warn' ],
'crit' : [ 'crit' ],
'error' : [ 'error' ]
}
; special config for 'failover' events
[failover]
targets = log:error, file:mqttwarn
[config:carbon]
targets = {
'openhab' : [ '{{graphite_server}}',2003 ],
}
[/openhab/graphite/#]
targets = carbon:openhab
;targets = log:info, file:f01, carbon:openhab
# instead of logging run `mosquitto_sub -t /openhab/graphite/#`

View File

@@ -1,17 +0,0 @@
[Unit]
Description=MQTTwarn
After=mosquitto.service
[Service]
Type=simple
User=pi
Group=pi
#WorkingDirectory=/home/pi
WorkingDirectory=/opt/mqttwarn
#Environment="MQTTWARNINI=/etc/mqttwarn.ini"
#ExecStart=/usr/local/bin/mqttwarn
ExecStart=/opt/mqttwarn/mqttwarn.py
[Install]
WantedBy=default.target