forked from davestephens/ansible-nas
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #104 from anarion80/add_ha_fusion
✨ Adds HA Fusion
- Loading branch information
Showing
10 changed files
with
150 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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>. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
provisioner: | ||
inventory: | ||
group_vars: | ||
all: | ||
hafusion_enabled: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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>. |