Commit 2f57e4de authored by Nicolas Steinmetz's avatar Nicolas Steinmetz
Browse files

Add Java Network and USB Device permissions, Fix Java ldconfig, Reduce restart

parent 7f82ac4a
---
openhab_zulu_package: zulu8.33.0.134-jdk1.8.0_192-linux_aarch32hf
openhab_zulu_package: zulu8.38.0.163-ca-jdk1.8.0_212-linux_aarch32hf
openhab_use_zwave: no
openhab_deb_version: 2.4.0-1
\ No newline at end of file
......@@ -3,13 +3,15 @@
get_url:
url: "http://cdn.azul.com/zulu-embedded/bin/{{ openhab_zulu_package }}.tar.gz"
dest: /tmp/zulu_java.tar.gz
mode: 0640
mode: 0640
register: zulu_download
- name: Extract Zulu Archive
unarchive:
src: /tmp/zulu_java.tar.gz
dest: /opt/
remote_src: yes
when: zulu_download.changed
- name: Symlink Zulu JRE to /opt/java
file:
......@@ -54,9 +56,17 @@
name: openhab
groups: ['tty', 'dialout']
append: yes
when: openhab_use_zwave
notify:
- restart openhab
when: openhab_use_zwave|bool
- name: Add OpenHab user to audio and bluetooth groups
user:
name: openhab
groups: ['audio', 'bluetooth']
append: yes
- name: Set Network permissions for java
shell: setcap 'cap_net_raw,cap_net_admin=+eip cap_net_bind_service=+ep' $(realpath /usr/bin/java)
become: true
- name: Install OpenHab and Addons
apt:
......@@ -64,8 +74,26 @@
state: present
update_cache: yes
cache_valid_time: 3600
notify:
- restart openhab
- name: Add JAVA OPTS for ZWave
replace:
path: /etc/default/openhab2
regexp: '^EXTRA_JAVA_OPTS=""$'
replace: 'EXTRA_JAVA_OPTS="-Dgnu.io.rxtx.SerialPorts=/dev/ttyUSB0:/dev/ttyS0:/dev/ttyS2:/dev/ttyACM0:/dev/ttyAMA0"'
when: openhab_use_zwave|bool
- name: Fix lib path for java
template:
src: java.conf.j2
dest: /etc/ld.so.conf.d/java.conf
mode: 0644
owner: root
group: root
register: ld_config
- name: Reload ldconfig cache
command: ldconfig
when: ld_config.changed
- name: Enable and start OpenHab
systemd:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment