homeassistant: Add support for custom integrations

This commit is contained in:
Timo Makinen 2023-07-22 16:29:36 +00:00
parent 69411beca5
commit 8b75d26eb8

View file

@ -12,8 +12,11 @@
- name: Install dependencies
ansible.builtin.package:
name: bluez
name: "{{ item }}"
state: installed
with_items:
- bluez
- git
- name: Enable bluetooth services
ansible.builtin.service:
@ -79,6 +82,37 @@
group: "{{ ansible_wheel }}"
setype: _default
- name: Create directories for custom integrations
ansible.builtin.file:
path: "{{ item }}"
state: directory
mode: 0755
owner: root
group: "{{ ansible_wheel }}"
setype: _default
with_items:
- /srv/homeassistant/custom_components
- /srv/homeassistant/downloads
- name: Download extra integrations
ansible.builtin.git:
dest: "/srv/homeassistant/downloads/{{ item.name }}"
repo: "{{ item.repo }}"
update: true
version: "{{ item.version }}"
notify: Restart homeassistant
with_items: "{{ homeassistant_integrations|default([]) }}"
- name: Link extra integrations
ansible.builtin.file:
dest: "/srv/homeassistant/custom_components/{{ item.name }}"
src: "../downloads/{{ item.name }}/custom_components/{{ item.name }}"
state: link
owner: root
group: "{{ ansible_wheel }}"
follow: false
with_items: "{{ homeassistant_integrations|default([]) }}"
- name: Create service file
ansible.builtin.template:
dest: /etc/systemd/system/homeassistant-container.service