Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add homeassistant service #38

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions roles/home/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
TODO

## Notes

- Official Docs recommend running in privileged mode (it appears to facilitate
the opening of serial ports for Z-Wave devices etc) which I have not done as it
removes the benefits of running in a containerized environment.

- Official Docs recommend running in host networking mode, which is not implemented here.
1 change: 1 addition & 0 deletions roles/home/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
subdomain_homeassistant: home
7 changes: 7 additions & 0 deletions roles/home/tasks/backup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
- name: Backup home
ansible.builtin.include_role:
name: common
tasks_from: backup
vars:
app: home
9 changes: 9 additions & 0 deletions roles/home/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
- name: Install home
include_role:
name: common
tasks_from: install
vars:
app: home
data_dirs:
- config
7 changes: 7 additions & 0 deletions roles/home/tasks/remove.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
- name: Remove home
ansible.builtin.include_role:
name: common
tasks_from: remove
vars:
app: home
7 changes: 7 additions & 0 deletions roles/home/tasks/restore.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
- name: Restore home
ansible.builtin.include_role:
name: common
tasks_from: restore
vars:
app: home
25 changes: 25 additions & 0 deletions roles/home/templates/compose.yml.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
version: "3.8"
services:
homeassistant:
image: homeassistant/home-assistant
user: "{{uid}}:{{gid}}" # run the container service as app user (not root)
restart: unless-stopped
environment:
TZ: {{tz}}
volumes:
- {{app_root}}/config:/config
labels:
traefik.enable: "true"
traefik.http.routers.homeassistant.entrypoints: websecure
traefik.http.routers.homeassistant.rule: Host(`{{subdomain_homeassistant}}.{{domain}}`)
traefik.http.routers.homeassistant.tls: "true"
traefik.http.services.homeassistant.loadbalancer.server.port: 8123
{% if server_is_live %}
traefik.http.routers.get.tls.certresolver: {{cert_resolver}}
{% endif %}
networks:
- traefik

networks:
traefik:
external: true