roles/homeassistant: Deploy Home Assistant
This commit introduces a *homeassistant* role that installs and sets up Home Assistant using `pip`.
This commit is contained in:
54
roles/homeassistant/tasks/main.yml
Normal file
54
roles/homeassistant/tasks/main.yml
Normal file
@@ -0,0 +1,54 @@
|
||||
- name: ensure system dependencies are installed
|
||||
package:
|
||||
name:
|
||||
- python3-pip
|
||||
state: present
|
||||
tags:
|
||||
- install
|
||||
|
||||
- name: ensure homeassistant user exists
|
||||
user:
|
||||
name: homeassistant
|
||||
system: true
|
||||
home: /var/lib/homeassistant
|
||||
|
||||
- name: ensure homeassistant is installed
|
||||
become: true
|
||||
become_user: homeassistant
|
||||
pip:
|
||||
name: homeassistant
|
||||
extra_args: >-
|
||||
--user
|
||||
|
||||
- name: ensure homeassistant entry point is installed
|
||||
copy:
|
||||
src: hass.sh
|
||||
dest: /usr/local/bin/hass
|
||||
mode: '0755'
|
||||
notify:
|
||||
- restart homeassistant
|
||||
- name: ensure homeassistant systemd unit is installed
|
||||
copy:
|
||||
src: homeassistant.service
|
||||
dest: /etc/systemd/system/homeassistant.service
|
||||
mode: '0644'
|
||||
notify:
|
||||
- reload systemd
|
||||
- restart homeassistant
|
||||
- name: ensure homeassistant starts at boot
|
||||
service:
|
||||
name: homeassistant
|
||||
enabled: true
|
||||
|
||||
- name: ensure apache is configured to proxy for homeassistant
|
||||
template:
|
||||
src: homeassistant.httpd.conf.j2
|
||||
dest: /etc/httpd/conf.d/homeassistant.conf
|
||||
mode: '0644'
|
||||
notify:
|
||||
- restart httpd
|
||||
- name: ensure selinux allows apache to proxy
|
||||
seboolean:
|
||||
name: httpd_can_network_connect
|
||||
state: true
|
||||
persistent: true
|
||||
Reference in New Issue
Block a user