add option to install plugins
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Robert Kaussow 2021-04-17 14:11:48 +02:00
parent 56e20abcf2
commit 46ec97b051
Signed by: xoxys
GPG Key ID: 65362AE74AF98B61
2 changed files with 29 additions and 1 deletions

View File

@ -19,6 +19,9 @@ homeassistant_networks:
homeassistant_networks_applied:
- default
homeassistant_data_dir: /opt/homeassistant/config
homeassistant_plugin_dir: /opt/homeassistant/config/www/plugins
# @var homeassistant_volumes:description: Define required docker volumes.
# @var homeassistant_volumes:example: >
# homeassistant_volumes:
@ -34,7 +37,7 @@ homeassistant_networks_applied:
# bind_opt: "ro,z"
# @end
homeassistant_volumes:
- name: /opt/homeassistant/config
- name: "{{ homeassistant_data_dir }}"
dest: /config
bind: True
@ -79,3 +82,13 @@ homeassistant_exclude_modemmanager: False
homeassistant_serial_device:
- vendor_id: "0000"
product_id: "xxxx"
# @var homeassistant_plugins:description: Plugins will be downloaded to `homeassistant_plugin_dir` and need to be a single raw file.
# @var homeassistant_plugins:example: >
# homeassistant_plugins:
# - name: button-card.js
# url: https://github.com/custom-cards/button-card/releases/download/v3.4.2/button-card.js
# - name: card-tools.js
# url: https://raw.githubusercontent.com/thomasloven/lovelace-card-tools/11/card-tools.js
# @end
homeassistant_plugins: []

View File

@ -16,6 +16,14 @@
label: "{{ item.name }}"
when: item.bind | bool
- name: Prepare directories
file:
path: "{{ item }}"
state: directory
mode: 0640
loop:
- "{{ homeassistant_plugin_dir }}"
- name: Deploy compose file to '{{ homeassistant_service_directory }}'
template:
src: "services/homeassistant_compose.yml.j2"
@ -40,6 +48,13 @@
when: homeassistant_exclude_modemmanager | bool
notify: __udev_reload
- name: Fetch plugins
get_url:
url: "{{ item.url }}"
dest: "{{ homeassistant_plugin_dir }}/{{ item.name }}"
mode: 0640
loop: "{{ homeassistant_plugins }}"
- name: Ensure service is up and running
docker_compose:
project_src: "{{ homeassistant_service_directory }}"