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

@@ -3,11 +3,6 @@
jdk: "zulu11.45.27-ca-jdk11.0.10-linux_aarch32hf" jdk: "zulu11.45.27-ca-jdk11.0.10-linux_aarch32hf"
jdk_url: "https://cdn.azul.com/zulu-embedded/bin/{{ jdk }}.tar.gz" jdk_url: "https://cdn.azul.com/zulu-embedded/bin/{{ jdk }}.tar.gz"
openhab_version: "3.0.1"
openhab_userid: "1000"
openhab_groupid: "1000"
openhab_root_dir: "/home/pi/openhab"
timezone: "Europe/Zurich" timezone: "Europe/Zurich"
locale: "en_US.UTF-8" locale: "en_US.UTF-8"

View File

@@ -5,7 +5,6 @@
gather_facts: no gather_facts: no
roles: roles:
- raspberry - raspberry
#- mqttwarn
- openhab - openhab

View File

@@ -1,28 +0,0 @@
---
- hosts: controller
become: true
tasks:
- name: stop openhab
service: name=openhab state=stopped
- name: delete default config
file:
path: "/etc/openhab"
state: absent
- name: create config dir
file:
path: "/etc/openhab"
owner: pi
group: pi
state: directory
- name: clone config repo
git:
repo: "{{vault_openhab_config_repo}}"
dest: "/etc/openhab"
accept_hostkey: true
update: no
clone: yes
become: false
- name: start openhab
service: name=openhab state=started

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