mirror of
https://github.com/schnidrig/openhab-ansible
synced 2026-01-12 00:48:46 +01:00
added gardena monitor
This commit is contained in:
17
roles/openhab2/tasks/gardena.yml
Normal file
17
roles/openhab2/tasks/gardena.yml
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
|
||||||
|
- name: install gardena service file
|
||||||
|
template:
|
||||||
|
src: "gardena.service"
|
||||||
|
dest: "/etc/systemd/system/gardena.service"
|
||||||
|
mode: u=rw,g=rw,o=r
|
||||||
|
|
||||||
|
- name: enable gardena service
|
||||||
|
systemd:
|
||||||
|
daemon_reload: yes
|
||||||
|
|
||||||
|
- name: Make sure gardena service is running
|
||||||
|
systemd:
|
||||||
|
state: started
|
||||||
|
name: gardena
|
||||||
|
|
||||||
|
|
||||||
@@ -11,6 +11,9 @@
|
|||||||
- include: dynv6.yml
|
- include: dynv6.yml
|
||||||
- include: letsencrypt.yml
|
- include: letsencrypt.yml
|
||||||
- include: scripts.yml
|
- include: scripts.yml
|
||||||
|
- include: gardena.yml
|
||||||
|
tags:
|
||||||
|
- gardena
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -23,13 +23,12 @@
|
|||||||
url: "{{ item.src }}"
|
url: "{{ item.src }}"
|
||||||
dest: "/usr/share/openhab2/runtime/lib/boot/{{ item.name }}"
|
dest: "/usr/share/openhab2/runtime/lib/boot/{{ item.name }}"
|
||||||
loop:
|
loop:
|
||||||
- { name: "jython-standalone-2.7.0.jar", src: "http://search.maven.org/remotecontent?filepath=org/python/jython-standalone/2.7.0/jython-standalone-2.7.0.jar" }
|
#- { name: "jython-standalone-2.7.0.jar", src: 'http://search.maven.org/remotecontent?filepath=org/python/jython-standalone/2.7.0/jython-standalone-2.7.0.jar' }
|
||||||
- { name: "snakeyaml-1.18.jar", src: "http://central.maven.org/maven2/org/yaml/snakeyaml/1.18/snakeyaml-1.18.jar" }
|
- { name: "snakeyaml-1.18.jar", src: "http://central.maven.org/maven2/org/yaml/snakeyaml/1.18/snakeyaml-1.18.jar" }
|
||||||
tags:
|
tags:
|
||||||
- openhab2
|
- openhab2
|
||||||
- jython
|
- jython
|
||||||
|
|
||||||
|
|
||||||
- name: cron job
|
- name: cron job
|
||||||
cron:
|
cron:
|
||||||
name: "restart openhab"
|
name: "restart openhab"
|
||||||
@@ -55,3 +54,24 @@
|
|||||||
tags:
|
tags:
|
||||||
- openhab2
|
- openhab2
|
||||||
- openhab_cron
|
- openhab_cron
|
||||||
|
|
||||||
|
|
||||||
|
- name: install python modules for jython
|
||||||
|
pip:
|
||||||
|
virtualenv: "/etc/openhab2/automation/lib/python"
|
||||||
|
virtualenv_command: "/usr/bin/virtualenv"
|
||||||
|
virtualenv_python: "/usr/bin/python2.7"
|
||||||
|
name: jsonmerge
|
||||||
|
tags:
|
||||||
|
- openhab2
|
||||||
|
|
||||||
|
- name: enable virtual env from above in jython
|
||||||
|
lineinfile:
|
||||||
|
path: "/etc/default/openhab2"
|
||||||
|
regexp: '^EXTRA_JAVA_OPTS='
|
||||||
|
line: 'EXTRA_JAVA_OPTS="-Dpython.path=/etc/openhab2/automation/lib/python/lib/python2.7/site-packages/"'
|
||||||
|
tags:
|
||||||
|
- openhab2
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ TIMESTAMP=`date +%Y%m%d`;
|
|||||||
tar -C / -czf /tmp/openhab2-backup-$TIMESTAMP.tgz etc/openhab2 var/lib/openhab2
|
tar -C / -czf /tmp/openhab2-backup-$TIMESTAMP.tgz etc/openhab2 var/lib/openhab2
|
||||||
|
|
||||||
echo "Now save the file /tmp/openhab2-backup-$TIMESTAMP.tgz"
|
echo "Now save the file /tmp/openhab2-backup-$TIMESTAMP.tgz"
|
||||||
echo " as regular user run: scp /tmp/openhab2-backup-20190422.tgz christian@ds3018:/volume1/backup"
|
echo " as regular user run: scp /tmp/openhab2-backup-$TIMESTAMP.tgz christian@ds3018:/volume1/backup"
|
||||||
|
|
||||||
# start openhab instance
|
# start openhab instance
|
||||||
#sudo systemctl start openhab2.service
|
#sudo systemctl start openhab2.service
|
||||||
|
|||||||
8
roles/openhab2/templates/gardena.service
Normal file
8
roles/openhab2/templates/gardena.service
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Service monitoring gardena web service
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
ExecStart=/etc/openhab2/automation/gardena_monitor_collector.py
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
@@ -10,8 +10,17 @@
|
|||||||
- ntp
|
- ntp
|
||||||
- tmux
|
- tmux
|
||||||
- python-pip
|
- python-pip
|
||||||
|
- python3-pip
|
||||||
- git
|
- git
|
||||||
- multitail
|
- multitail
|
||||||
|
- python3-requests
|
||||||
|
tags:
|
||||||
|
- packages
|
||||||
|
|
||||||
|
- name: install python 3 modules with pip
|
||||||
|
pip:
|
||||||
|
name: websocket-client
|
||||||
|
executable: pip3
|
||||||
tags:
|
tags:
|
||||||
- packages
|
- packages
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user