From 4d04410b1788cb0cb50782d69437bdbb7c2c6745 Mon Sep 17 00:00:00 2001 From: CherryKitten Date: Tue, 13 Aug 2019 14:38:15 +0200 Subject: [PATCH 1/5] Add openHAB support --- group_vars/all.yml.dist | 10 ++++++++ nas.yml | 6 +++++ tasks/openhab.yml | 51 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 67 insertions(+) create mode 100644 tasks/openhab.yml diff --git a/group_vars/all.yml.dist b/group_vars/all.yml.dist index 08a5dc04..80796154 100644 --- a/group_vars/all.yml.dist +++ b/group_vars/all.yml.dist @@ -77,6 +77,8 @@ wallabag_enabled: false # MQTT mosquitto_enabled: false +# Smarthome +openhab_enabled: false ### ### General ### @@ -572,3 +574,11 @@ wallabag_data_directory: "{{ docker_home }}/wallabag" ### mosquitto_available_externally: "false" mosquitto_data_directory: "{{ docker_home }}/mosquitto" + +### +### openHAB +### +openhab_available_externally: "false" +openhab_docker_image: openhab/openhab:latest +openhab_data_directory: "{{ docker_home }}/openhab" + diff --git a/nas.yml b/nas.yml index c351ca5e..493cdc46 100644 --- a/nas.yml +++ b/nas.yml @@ -171,3 +171,9 @@ - import_tasks: tasks/mosquitto.yml when: (mosquitto_enabled | default(False)) tags: mosquitto + + - import_tasks: tasks/openhab.yml + when: (openhab_enabled | default(False)) + tags: openhab + + diff --git a/tasks/openhab.yml b/tasks/openhab.yml new file mode 100644 index 00000000..6e3e59de --- /dev/null +++ b/tasks/openhab.yml @@ -0,0 +1,51 @@ +--- +- name: Create openHAB group + group: + name: openhab + gid: 9001 + state: present + +- name: Create openHAB user + user: + name: openhab + uid: 9001 + state: present + system: yes + update_password: on_create + create_home: no + group: openhab + +- name: Create openHAB Directories + file: + path: "{{ item }}" + state: directory + owner: openhab + group: openhab + with_items: + - "{{ openhab_data_directory }}" + - "{{ openhab_data_directory }}/conf" + - "{{ openhab_data_directory }}/userdata" + - "{{ openhab_data_directory }}/addons" + +- name: Create openHAB container + docker_container: + name: openHAB + image: "{{ openhab_docker_image }}" + pull: true + network_mode: "host" + volumes: + - "{{ openhab_data_directory }}/conf:/openhab/conf:rw" + - "{{ openhab_data_directory }}/userdata:/openhab/userdata:rw" + - "{{ openhab_data_directory }}/addons:/openhab/addons:rw" + - "/etc/localtime:/etc/localtime:ro" + - "/etc/timezone:/etc/timezone:ro" + env: + OPENHAB_HTTP_PORT: "7777" + OPENHAB_HTTPS_PORT: "7778" + restart_policy: unless-stopped + memory: 1g + labels: + traefik.backend: "openhab" + traefik.frontend.rule: "Host:openhab.{{ ansible_nas_domain }}" + traefik.enable: "{{ openhab_available_externally }}" + traefik.port: "80" From e9ce59f44b564ac4a92c0a631e1c40acef0e4b7a Mon Sep 17 00:00:00 2001 From: CherryKitten Date: Tue, 13 Aug 2019 14:43:26 +0200 Subject: [PATCH 2/5] Add openHAB to traefik.toml --- templates/traefik/traefik.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/templates/traefik/traefik.toml b/templates/traefik/traefik.toml index c22832eb..201e98ad 100644 --- a/templates/traefik/traefik.toml +++ b/templates/traefik/traefik.toml @@ -195,6 +195,7 @@ onDemand = false # create certificate when container is created "netdata.{{ ansible_nas_domain }}", "nextcloud.{{ ansible_nas_domain }}", "nzbget.{{ ansible_nas_domain }}", + "openhab.{{ ansible_nas_domain }}", "plex.{{ ansible_nas_domain }}", "portainer.{{ ansible_nas_domain }}", "pyload.{{ ansible_nas_domain }}", From 4ecb42f85367c978dbb909dc3ba3932508521dc2 Mon Sep 17 00:00:00 2001 From: CherryKitten Date: Tue, 13 Aug 2019 14:48:19 +0200 Subject: [PATCH 3/5] Add a missing line break --- group_vars/all.yml.dist | 1 + 1 file changed, 1 insertion(+) diff --git a/group_vars/all.yml.dist b/group_vars/all.yml.dist index 80796154..9e85c540 100644 --- a/group_vars/all.yml.dist +++ b/group_vars/all.yml.dist @@ -79,6 +79,7 @@ mosquitto_enabled: false # Smarthome openhab_enabled: false + ### ### General ### From 8942d8a6479d13089c2520d1d45dc56fe16beb4a Mon Sep 17 00:00:00 2001 From: CherryKitten Date: Tue, 13 Aug 2019 15:07:33 +0200 Subject: [PATCH 4/5] Added documentation for openHAB --- README.md | 1 + docs/applications/openhab.md | 15 +++++++++++++++ docs/configuration/application_ports.md | 2 ++ 3 files changed, 18 insertions(+) create mode 100644 docs/applications/openhab.md diff --git a/README.md b/README.md index 11ff3f88..d86a2b3e 100644 --- a/README.md +++ b/README.md @@ -50,6 +50,7 @@ Ansible config and a bunch of Docker containers. * [Netdata](https://my-netdata.io/) - An extremely comprehensive system monitoring solution * [Nextcloud](https://nextcloud.com/) - A self-hosted Dropbox alternative * [NZBget](https://nzbget.net/) - The most efficient usenet downloader +* [openHAB](https://www.openhab.org/) - A vendor and technology agnostic open source automation software for your home * [Plex](https://www.plex.tv/) - Plex Media Server * [Portainer](https://portainer.io/) - for managing Docker and running custom images * [pyLoad](https://pyload.net/) - A download manager with a friendly web-interface diff --git a/docs/applications/openhab.md b/docs/applications/openhab.md new file mode 100644 index 00000000..aee723ef --- /dev/null +++ b/docs/applications/openhab.md @@ -0,0 +1,15 @@ +# openHAB + +Homepage: [https://www.openhab.org/](https://www.openhab.org/) + +OpenHab is a vendor and technology agnostic open source automation software for your home. +It allows you to connect many different IoT-Devices (which in this case means "Intranet of Things") using custom bindings made by the community. + +## Usage + +Set `openhab_enabled: true` in your `group_vars/all.yml` file. + +## Specific Configuration + +The openHAB Webinterface is available at port 7777 (HTTP) and 7778 (HTTPS). +Visit the webinterface and follow the setup instructions found in the [openHAB Documentation](https://www.openhab.org/docs/tutorial/1sttimesetup.html) diff --git a/docs/configuration/application_ports.md b/docs/configuration/application_ports.md index f0f8e848..1e534b0e 100644 --- a/docs/configuration/application_ports.md +++ b/docs/configuration/application_ports.md @@ -27,6 +27,8 @@ By default, applications can be found on the ports listed below. | Netdata | 19999 | | | Nextcloud | 8080 | | | NZBGet | 6789 | | +| openHAB | 7777 | HTTP | +| openHAB | 7778 | HTTPS | | Plex | 32400 | | | Portainer | 9000 | | | pyload | 8000 | | From c7f74c8084695634a0a9ec5ab7d29a0f952fb104 Mon Sep 17 00:00:00 2001 From: CherryKitten Date: Tue, 13 Aug 2019 15:13:36 +0200 Subject: [PATCH 5/5] Remove trailing whitespaces --- tasks/openhab.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tasks/openhab.yml b/tasks/openhab.yml index 6e3e59de..312f60c8 100644 --- a/tasks/openhab.yml +++ b/tasks/openhab.yml @@ -1,25 +1,25 @@ --- - name: Create openHAB group group: - name: openhab - gid: 9001 + name: openhab + gid: 9001 state: present - name: Create openHAB user user: - name: openhab - uid: 9001 + name: openhab + uid: 9001 state: present system: yes update_password: on_create create_home: no - group: openhab + group: openhab - name: Create openHAB Directories file: path: "{{ item }}" state: directory - owner: openhab + owner: openhab group: openhab with_items: - "{{ openhab_data_directory }}"