From 2baffca0f53f4b43cdbcbe6aa4abb2f31473db6a Mon Sep 17 00:00:00 2001 From: Salt Date: Mon, 27 Sep 2021 17:18:30 -0500 Subject: [PATCH] Add configuration for Home Assistant --- playbooks/home_automation.yml | 42 +++++++++++++++++++++++++++ playbooks/home_media.yml | 1 + playbooks/tasks/app/homeassistant.yml | 12 ++++++++ site.yml | 1 + 4 files changed, 56 insertions(+) create mode 100755 playbooks/home_automation.yml create mode 100644 playbooks/tasks/app/homeassistant.yml diff --git a/playbooks/home_automation.yml b/playbooks/home_automation.yml new file mode 100755 index 0000000..34eed1c --- /dev/null +++ b/playbooks/home_automation.yml @@ -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 ] diff --git a/playbooks/home_media.yml b/playbooks/home_media.yml index 6c9f2c5..772214e 100755 --- a/playbooks/home_media.yml +++ b/playbooks/home_media.yml @@ -61,6 +61,7 @@ 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 diff --git a/playbooks/tasks/app/homeassistant.yml b/playbooks/tasks/app/homeassistant.yml new file mode 100644 index 0000000..6c266c5 --- /dev/null +++ b/playbooks/tasks/app/homeassistant.yml @@ -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 ] diff --git a/site.yml b/site.yml index 6ee918f..35e7dea 100755 --- a/site.yml +++ b/site.yml @@ -15,6 +15,7 @@ - import_playbook: playbooks/device_roles_workstation.yml # Home configuration - import_playbook: playbooks/home_media.yml +- import_playbook: playbooks/home_automation.yml # Production configuration - import_playbook: playbooks/prod_db.yml - import_playbook: playbooks/prod_web.yml