1
0
Fork 0

add homeassistant role

This commit is contained in:
Massaki Archambault 2023-06-04 16:59:59 -04:00
parent 8b5902134b
commit e392e201f4
5 changed files with 83 additions and 0 deletions

5
hosts
View File

@ -30,6 +30,10 @@ all:
nfs_libraries: nfs_libraries:
- 192.168.20.30:/mnt/pool0/media/Movies - 192.168.20.30:/mnt/pool0/media/Movies
- 192.168.20.30:/mnt/pool0/media/Series - 192.168.20.30:/mnt/pool0/media/Series
homeassistant:
hosts:
homeassistant:
ansible_host: 192.168.20.32
k3s: k3s:
children: children:
k3s-server: k3s-server:
@ -63,6 +67,7 @@ all:
bastions: bastions:
k3s: k3s:
plex: plex:
homeassistant:
vars: vars:
ansible_user: ansible ansible_user: ansible
ansible_password: !vault | ansible_password: !vault |

View File

@ -21,3 +21,7 @@
- hosts: plex - hosts: plex
roles: roles:
- plex - plex
- hosts: homeassistant
roles:
- homeassistant

View File

View File

@ -0,0 +1,13 @@
[Unit]
Description=Home Assistant
Documentation=https://www.home-assistant.io
After=network-online.target
[Service]
Type=simple
User=homeassistant
Group=homeassistant
ExecStart=/srv/homeassistant/bin/python3 /srv/homeassistant/bin/hass
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,61 @@
- name: Install packages
apt:
update_cache: yes
name:
- acl # for become unprivileged user
- python3
- python3-dev
- python3-venv
- python3-pip
- bluez
- libffi-dev
- libssl-dev
- libjpeg-dev
- zlib1g-dev
- autoconf
- build-essential
- libopenjp2-7
- libtiff5
- libturbojpeg0-dev
- tzdata
- ffmpeg
- liblapack3
- liblapack-dev
- libatlas-base-dev
- name: Add user "homeassistant"
user:
name: homeassistant
create_home: true
system: true
- name: Create homeassistant install directory
file:
path: /srv/homeassistant
owner: homeassistant
group: homeassistant
state: directory
- name: Install homeassistant
become_user: homeassistant
pip:
virtualenv: /srv/homeassistant/
virtualenv_command: /usr/bin/python3 -m venv
name:
- wheel
- homeassistant==2023.5.4
- name: Copy hass service file
copy:
src: hass.service
dest: /etc/systemd/system/hass.service
owner: root
group: root
mode: 0644
- name: Enable hass service
systemd:
name: hass
daemon_reload: yes
state: started
enabled: yes