Commit eb74c3e9 authored by Nicolas Steinmetz's avatar Nicolas Steinmetz
Browse files

Initial commit

parents
Pipeline #174 canceled with stages
# OpenHab
## Overview
Install [OpenHab](https://www.openhab.org/) smart home solution with [ansible](https://www.ansible.com/).
It will install OpenHab with [Zulu JRE](https://www.azul.com/products/zulu/) as recommended in the [prerequisites](https://www.openhab.org/docs/installation/#prerequisites)
## Dependencies
None
## Variables
`openhab_zulu_package`: name of the package to download - default value matches version for Raspberry V2 - See [ARM Packages](https://www.azul.com/downloads/zulu-embedded/)
`openhab_use_zwave` : if you use a zwave binding, it will add openhab user to the `tty` and `dialout` groups as expected.
## Author and support
Author : [Nicolas Steinmetz](mailto:contact+ansible@cerenit.fr)
Support: [Gitlab instance](https://code.cerenit.fr/nsteinmetz/ansible-openhab) - [Github](https://github.com/nsteinmetz/ansible-openhab)
\ No newline at end of file
---
openhab_zulu_package: zulu8.31.1.122-jdk1.8.0_181-linux_aarch32hf
openhab_use_zwave: no
\ No newline at end of file
---
- name: restart openhab
systemd:
name: openhab2
daemon_reload: yes
state: restarted
\ No newline at end of file
---
- name: Download Zulu JRE
get_url:
url: "http://cdn.azul.com/{{ openhab_zulu_package }}.tar.gz"
dest: /tmp/zulu_java.tar.gz
mode: 0640
- name: Extract Zulu Archive
unarchive:
src: /tmp/zulu_java.tar.gz
dest: /opt/
remote_src: yes
- name: Symlink Zulu JRE to /opt/java
file:
src: "/opt/{{ openhab_zulu_package }}"
dest: /opt/java
state: link
- name: Make Zulu JRE default JAVA program
alternatives:
link: /usr/bin/java
name: java
path: /opt/java/bin/java
- name: Add OpenHab Repo key
apt_key:
url: https://bintray.com/user/downloadSubjectPublicKey?username=openhab
state: present
- name: Add OpenHab Repo
apt_repository:
repo: deb https://dl.bintray.com/openhab/apt-repo2 stable main
state: present
update_cache: yes
- name: Create openhab group
group:
name: openhab
state: present
gid: 114
- name: Create openhab user
user:
name: openhab
shell: /bin/false
home: /var/lib/openhab2
group: openhab
state: present
uid: 110
- name: Add OpenHab user to dialout and tty groups if using zwave
user:
name: openhab
groups: ['tty', 'dialout']
append: yes
when: openhab_use_zwave
notify:
- restart openhab
- name: Install OpenHab and Addons
apt:
name: ['openhab2', 'openhab2-addons']
state: present
update_cache: yes
cache_valid_time: 3600
notify:
- restart openhab
- name: Enable and start OpenHab
systemd:
name: openhab2
state: started
enabled: yes
daemon_reload: yes
\ No newline at end of file
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