From c680dbcb064760eb867bbac89c599667caff0b38 Mon Sep 17 00:00:00 2001 From: Sam Maes Date: Tue, 23 Jul 2019 20:07:40 +0000 Subject: [PATCH] Add Home Assistant --- README.md | 1 + docs/applications/homeassistant.md | 12 ++++++++++++ docs/configuration/application_ports.md | 1 + group_vars/all.yml.dist | 10 +++++++++- nas.yml | 4 ++++ tasks/homeassistant.yml | 25 +++++++++++++++++++++++++ templates/traefik/traefik.toml | 1 + 7 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 docs/applications/homeassistant.md create mode 100644 tasks/homeassistant.yml diff --git a/README.md b/README.md index cae3cf95..c510e1de 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,7 @@ Ansible config and a bunch of Docker containers. * [Grafana](https://github.com/grafana/grafana) - Dashboarding tool * [Guacamole](https://guacamole.apache.org/) - Web based remote desktop gateway, supports VNC, RDP and SSH * [Heimdall](https://heimdall.site/) - Home server dashboard +* [Home Assistant](https://www.home-assistant.io) - Open source home automation * [InfluxDB](https://github.com/influxdata/influxdb) - Time series database used for stats collection * [Jackett](https://github.com/Jackett/Jackett) - API Support for your favorite torrent trackers * [MiniDlna](https://sourceforge.net/projects/minidlna/) - simple media server which is fully compliant with DLNA/UPnP-AV clients diff --git a/docs/applications/homeassistant.md b/docs/applications/homeassistant.md new file mode 100644 index 00000000..29983c2e --- /dev/null +++ b/docs/applications/homeassistant.md @@ -0,0 +1,12 @@ +# Home Assistant + +Homepage: [https://www.home-assistant.io/](https://www.home-assistant.io/) + + +## Usage + +Set `homeassistant_enabled: true` in your `group_vars/all.yml` file. + +If you want to access Home Assistant externally, don't forget to set `homeassistant_available_externally: "true"` in your `group_vars/all.yml` file. + +The Home Assistant web interface can be found at http://ansible_nas_host_or_ip:8123. diff --git a/docs/configuration/application_ports.md b/docs/configuration/application_ports.md index f0f8e848..78db7c61 100644 --- a/docs/configuration/application_ports.md +++ b/docs/configuration/application_ports.md @@ -18,6 +18,7 @@ By default, applications can be found on the ports listed below. | Grafana | 3000 | | | Guacamole | 8090 | | | Heimdall | 10080 | | +| Home Assistant | 8123 | | | Jackett | 9117 | | | MiniDLNA | 8201 | | | Miniflux | 8070 | | diff --git a/group_vars/all.yml.dist b/group_vars/all.yml.dist index 08a5dc04..83ac71e9 100644 --- a/group_vars/all.yml.dist +++ b/group_vars/all.yml.dist @@ -74,7 +74,8 @@ firefly_enabled: false # Wallabag wallabag_enabled: false -# MQTT +# Home Automation +homeassistant_enabled: true mosquitto_enabled: false ### @@ -568,7 +569,14 @@ nzbget_group_id: 0 wallabag_available_externally: "false" wallabag_data_directory: "{{ docker_home }}/wallabag" +### ### Mosquitto ### mosquitto_available_externally: "false" mosquitto_data_directory: "{{ docker_home }}/mosquitto" + +### +### Home Assistant +### +homeassistant_available_externally: "false" +homeassistant_data_directory: "{{ docker_home }}/homeassistant" diff --git a/nas.yml b/nas.yml index c351ca5e..0c6a0802 100644 --- a/nas.yml +++ b/nas.yml @@ -171,3 +171,7 @@ - import_tasks: tasks/mosquitto.yml when: (mosquitto_enabled | default(False)) tags: mosquitto + + - import_tasks: tasks/homeassistant.yml + when: (homeassistant_enabled | default(False)) + tags: homeassistant diff --git a/tasks/homeassistant.yml b/tasks/homeassistant.yml new file mode 100644 index 00000000..5b249991 --- /dev/null +++ b/tasks/homeassistant.yml @@ -0,0 +1,25 @@ +- name: Create Home Assistant Directories + file: + path: "{{ item }}" + state: directory + with_items: + - "{{ homeassistant_data_directory }}/config" + +- name: Home Assistant Docker Container + docker_container: + name: homeassistant + image: homeassistant/home-assistant + pull: true + volumes: + - "{{ homeassistant_data_directory }}/config:/config:rw" + ports: + - "8123:8123" + network_mode: "host" + restart_policy: unless-stopped + labels: + traefik.backend: "homeassistant" + traefik.frontend.rule: "Host:homeassistant.{{ ansible_nas_domain }}" + traefik.enable: "{{ homeassistant_available_externally }}" + traefik.port: "80" + traefik.frontend.headers.SSLRedirect: "true" + memory: 1g diff --git a/templates/traefik/traefik.toml b/templates/traefik/traefik.toml index c22832eb..d5c23712 100644 --- a/templates/traefik/traefik.toml +++ b/templates/traefik/traefik.toml @@ -190,6 +190,7 @@ onDemand = false # create certificate when container is created "grafana.{{ ansible_nas_domain }}", "guacamole.{{ ansible_nas_domain }}", "heimdall.{{ ansible_nas_domain }}", + "homeassistant.{{ ansible_nas_domain }}", "jackett.{{ ansible_nas_domain }}", "miniflux.{{ ansible_nas_domain }}", "netdata.{{ ansible_nas_domain }}",