Add configuration for Home Assistant

This commit is contained in:
Salt 2021-09-27 17:18:30 -05:00
parent cfba2ec859
commit 2baffca0f5
4 changed files with 56 additions and 0 deletions

42
playbooks/home_automation.yml Executable file
View File

@ -0,0 +1,42 @@
#!/usr/bin/env ansible-playbook
# vim:ft=ansible:
---
# Home media storage Pi
- hosts: pi-homeauto-1.desu.ltd
module_defaults:
docker_container:
state: started
restart_policy: unless-stopped
pull: yes
pre_tasks:
- name: ensure docker network
docker_network: name=web
tags: [ docker ]
tasks:
- name: include tasks for apps
include_tasks: tasks/app/{{ task }}
with_items:
- homeassistant.yml
loop_control:
loop_var: task
tags: [ always ]
roles:
- role: backup
vars:
backup_s3backup_list_extra:
- /data
backup_time: "Sun *-*-* 02:00:00"
tags: [ backup ]
- role: ingress
vars:
ingress_container_image: "nginx:latest"
ingress_container_ports:
- 80:80
ingress_container_config_mount: /etc/nginx/conf.d
ingress_container_persist_dir: /data/nginx
ingress_listen_args: 80
ingress_listen_tls: no
ingress_servers:
- name: homeauto.local.desu.ltd
proxy_pass: http://localhost:8123
tags: [ ingress ]

View File

@ -61,6 +61,7 @@
ingress_container_image: "nginx:latest" ingress_container_image: "nginx:latest"
ingress_container_ports: ingress_container_ports:
- 80:80 - 80:80
ingress_container_config_mount: /etc/nginx/conf.d
ingress_container_persist_dir: /data/nginx ingress_container_persist_dir: /data/nginx
ingress_listen_args: 80 ingress_listen_args: 80
ingress_listen_tls: no ingress_listen_tls: no

View File

@ -0,0 +1,12 @@
# vim:ft=ansible:
- name: docker deploy homeassistant
docker_container:
name: homeassistant
image: "ghcr.io/home-assistant/raspberrypi4-homeassistant:stable"
privileged: yes
network_mode: host
volumes:
- /dev/ttyACM0:/dev/ttyACM0
- /etc/localtime:/etc/localtime:ro
- /data/homeassistant/config:/config
tags: [ docker, homeassistant ]

View File

@ -15,6 +15,7 @@
- import_playbook: playbooks/device_roles_workstation.yml - import_playbook: playbooks/device_roles_workstation.yml
# Home configuration # Home configuration
- import_playbook: playbooks/home_media.yml - import_playbook: playbooks/home_media.yml
- import_playbook: playbooks/home_automation.yml
# Production configuration # Production configuration
- import_playbook: playbooks/prod_db.yml - import_playbook: playbooks/prod_db.yml
- import_playbook: playbooks/prod_web.yml - import_playbook: playbooks/prod_web.yml