diff --git a/roles/homeassistant/tasks/main.yml b/roles/homeassistant/tasks/main.yml index f2f53d1..46648b8 100644 --- a/roles/homeassistant/tasks/main.yml +++ b/roles/homeassistant/tasks/main.yml @@ -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