-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathsetup_home_assistant.yml
72 lines (66 loc) · 2.19 KB
/
setup_home_assistant.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
---
- name: Set up Home Assistant
hosts: nuc
become: yes
tasks:
- name: Create bind mounts
file:
path: "{{ item }}"
state: directory
loop:
- /home/rex/home-assistant
- /home/rex/home-assistant/config
become: no
- name: Start Home Assistant Docker container
docker_container:
name: home-assistant
image: "ghcr.io/home-assistant/home-assistant:stable"
volumes:
- /home/rex/home-assistant/config:/config
- /etc/localtime:/etc/localtime:ro
restart_policy: unless-stopped
privileged: true
network_mode: host # admin panel port: 8123
notify:
- Install HACS
- Restart container
- name: Configure reverse proxy in configuration.yaml
blockinfile:
dest: /home/rex/home-assistant/config/configuration.yaml
marker: "# {mark} ANSIBLE MANAGED BLOCK - reverse proxy"
block: |
{% set text = '''
http:
use_x_forwarded_for: true
trusted_proxies:
- 0.0.0.0/0
''' %}
{{ text | trim | indent(width=2) }}
- name: Configure HomeKit in configuration.yaml
blockinfile:
dest: /home/rex/home-assistant/config/configuration.yaml
marker: "# {mark} ANSIBLE MANAGED BLOCK - homekit"
block: |
{% set text = '''
homekit:
filter:
include_entities:
# - switch.gt_axe16000_guest_6_ghz_2
- fan.zhimi_mb1_7a19_air_purifier
- sensor.zhimi_mb1_7a19_indoor_temperature
- sensor.zhimi_mb1_7a19_pm25_density
- sensor.zhimi_mb1_7a19_relative_humidity
- vacuum.ijai_v17_9a62_robot_cleaner
- switch.mmgg_fi1_ef52_feeding_measure
- switch.mmgg_wi11_54d9_pet_drinking_fountain
''' %}
{{ text | trim | indent(width=2) }}
handlers:
- name: Install HACS
community.docker.docker_container_exec:
container: home-assistant
command: bash -c 'wget -O - https://get.hacs.xyz | bash -'
- name: Restart container
docker_container:
name: home-assistant
restart: true