Skip to content

Commit

Permalink
Merge pull request #104 from anarion80/add_ha_fusion
Browse files Browse the repository at this point in the history
✨ Adds HA Fusion
  • Loading branch information
anarion80 authored Dec 25, 2023
2 parents 6422954 + 6e15f45 commit b68009e
Show file tree
Hide file tree
Showing 10 changed files with 150 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ If you have a spare domain name you can configure applications to be accessible
* [Graylog](https://www.graylog.org/) - Free and open source log management
* [Grocy](https://grocy.info/) - web-based self-hosted groceries & household management solution for your home
* [Guacamole](https://guacamole.apache.org/) - Web based remote desktop gateway, supports VNC, RDP and SSH
* [HA Fusion](https://github.com/matt8707/ha-fusion) - A modern, easy-to-use and performant custom Home Assistant dashboard
* [healthchecks.io](https://healthchecks.io/) - Ensure your NAS is online and get notified otherwise
* [Heimdall](https://heimdall.site/) - Home server dashboard
* [Home Assistant](https://www.home-assistant.io) - Open source home automation
Expand Down
4 changes: 4 additions & 0 deletions nas.yml
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,10 @@
tags:
- guacamole

- role: hafusion
tags:
- hafusion

- role: healthchecks.io
tags:
- healthchecks.io
Expand Down
23 changes: 23 additions & 0 deletions roles/hafusion/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
hafusion_enabled: false
hafusion_available_externally: false

# directories
hafusion_data_directory: "{{ docker_home }}/hafusion"

# network
hafusion_port: "5051"
hafusion_hostname: "hafusion"

# specs
hafusion_memory: 1g

# docker
hafusion_container_name: hafusion
hafusion_image_name: "ghcr.io/matt8707/ha-fusion"
hafusion_image_version: latest
hafusion_user_id: "1000"
hafusion_group_id: "1000"

# hafusion
hafusion_hass_url: "http://192.168.1.241:8123"
11 changes: 11 additions & 0 deletions roles/hafusion/docs/hafusion.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# HA Fusion

Homepage: <https://github.com/matt8707/ha-fusion>

A modern, easy-to-use and performant custom Home Assistant dashboard

## Usage

Set `hafusion_enabled: true` in your `inventories/<your_inventory>/nas.yml` file.

hafusion web interface can be found at <http://ansible_nas_host_or_ip:5051>.
6 changes: 6 additions & 0 deletions roles/hafusion/molecule/default/molecule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
provisioner:
inventory:
group_vars:
all:
hafusion_enabled: true
10 changes: 10 additions & 0 deletions roles/hafusion/molecule/default/side_effect.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
- name: Stop
hosts: all
become: true
tasks:
- name: "Include {{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }} role"
ansible.builtin.include_role:
name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
vars:
hafusion_enabled: false
19 changes: 19 additions & 0 deletions roles/hafusion/molecule/default/verify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
- name: Verify
hosts: all
gather_facts: false
tasks:
- name: Include vars
ansible.builtin.include_vars:
file: ../../defaults/main.yml

- name: Get hafusion container state
community.docker.docker_container:
name: "{{ hafusion_container_name }}"
register: result

- name: Check if hafusion containers are running
ansible.builtin.assert:
that:
- result.container['State']['Status'] == "running"
- result.container['State']['Restarting'] == false
19 changes: 19 additions & 0 deletions roles/hafusion/molecule/default/verify_stopped.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
- name: Verify
hosts: all
gather_facts: false
tasks:
- name: Include vars
ansible.builtin.include_vars:
file: ../../defaults/main.yml

- name: Try and stop and remove hafusion
community.docker.docker_container:
name: "{{ hafusion_container_name }}"
state: absent
register: result

- name: Check if hafusion is stopped
ansible.builtin.assert:
that:
- not result.changed
43 changes: 43 additions & 0 deletions roles/hafusion/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
- name: Start HA Fusion
block:
- name: Create HA Fusion Directories
ansible.builtin.file:
path: "{{ item }}"
state: directory
with_items:
- "{{ hafusion_data_directory }}"

- name: Create HA Fusion Docker Container
community.docker.docker_container:
container_default_behavior: no_defaults
name: "{{ hafusion_container_name }}"
image: "{{ hafusion_image_name }}:{{ hafusion_image_version }}"
pull: true
volumes:
- "{{ hafusion_data_directory }}/data:/app/data"
ports:
- "{{ hafusion_port }}:5050"
env:
TZ: "{{ ansible_nas_timezone }}"
PUID: "{{ hafusion_user_id | quote }}"
PGID: "{{ hafusion_group_id | quote }}"
HASS_URL: "{{ hafusion_hass_url }}"
restart_policy: unless-stopped
memory: "{{ hafusion_memory }}"
labels:
traefik.enable: "{{ hafusion_available_externally | string }}"
traefik.http.routers.hafusion.rule: "Host(`{{ hafusion_hostname }}.{{ ansible_nas_domain }}`)"
traefik.http.routers.hafusion.tls.certresolver: "letsencrypt"
traefik.http.routers.hafusion.tls.domains[0].main: "{{ ansible_nas_domain }}"
traefik.http.routers.hafusion.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
traefik.http.services.hafusion.loadbalancer.server.port: "5050"
when: hafusion_enabled is true

- name: Stop HA Fusion
block:
- name: Stop HA Fusion
community.docker.docker_container:
name: "{{ hafusion_container_name }}"
state: absent
when: hafusion_enabled is false
14 changes: 14 additions & 0 deletions website/docs/applications/home-automation/hafusion.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
title: "HA Fusion"
description: "A modern, easy-to-use and performant custom Home Assistant dashboard"
---

Homepage: <https://github.com/matt8707/ha-fusion>

A modern, easy-to-use and performant custom Home Assistant dashboard

## Usage

Set `hafusion_enabled: true` in your `inventories/<your_inventory>/nas.yml` file.

hafusion web interface can be found at <http://ansible_nas_host_or_ip:5051>.

0 comments on commit b68009e

Please sign in to comment.