-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(install_hacs): Add new role to install Home Assistant Community …
…Store
- Loading branch information
1 parent
d584dfe
commit 010877f
Showing
9 changed files
with
139 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
install_hacs | ||
========= | ||
|
||
Install the [Home Assistant Community Store](https://hacs.xyz/) in Home Assistant Supervised. Use this role as an alternative to the HACS [install shell script](https://github.com/hacs/install/blob/main/install). | ||
|
||
Requirements | ||
------------ | ||
|
||
- unzip is required on the target host | ||
- The role must be ran as root or as an alternate user with `become: true` | ||
|
||
Role Variables | ||
-------------- | ||
|
||
The following varaibles are defined in `defaults/main.yml` | ||
|
||
```yaml | ||
# The path of the home assistant config directory. You should not need to change this for Supervised installation. | ||
ha_path: /usr/share/hassio/homeassistant | ||
|
||
# Automatically install software packages listed under requirements | ||
install_hacs_requirements: true | ||
``` | ||
Dependencies | ||
------------ | ||
none | ||
Example Playbook | ||
---------------- | ||
```yaml | ||
- hosts: pi | ||
roles: | ||
- name: jhampson_dbre.home_assistant.install_hacs | ||
``` | ||
License | ||
------- | ||
MIT | ||
Author Information | ||
------------------ | ||
@jhampson-dbre |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
ha_path: /usr/share/hassio/homeassistant | ||
install_hacs_requirements: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
galaxy_info: | ||
author: Jared Hampson | ||
description: Install Home Assistant Community Store in Home Assistant Supervised | ||
|
||
# If the issue tracker for your role is not on github, uncomment the | ||
# next line and provide a value | ||
# issue_tracker_url: http://example.com/issue/tracker | ||
|
||
# Choose a valid license ID from https://spdx.org - some suggested licenses: | ||
license: MIT | ||
|
||
min_ansible_version: 2.9 | ||
|
||
# If this a Container Enabled role, provide the minimum Ansible Container version. | ||
# min_ansible_container_version: | ||
|
||
# | ||
# Provide a list of supported platforms, and for each platform a list of versions. | ||
# If you don't wish to enumerate all versions for a particular platform, use 'all'. | ||
# To view available platforms and versions (or releases), visit: | ||
# https://galaxy.ansible.com/api/v1/platforms/ | ||
# | ||
platforms: | ||
- name: Debian | ||
versions: | ||
- buster | ||
|
||
galaxy_tags: | ||
- home | ||
- assistant | ||
- supervised | ||
- raspberry | ||
- pi | ||
- hassio | ||
- hacs | ||
|
||
dependencies: [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
--- | ||
- name: Install install_hacs role requirements | ||
import_tasks: requirements.yml | ||
when: install_hacs_requirements|bool | ||
|
||
- name: Create custom_components directory | ||
file: | ||
path: "{{ ha_path }}/custom_components" | ||
state: directory | ||
mode: '0755' | ||
|
||
- name: Clean up existing HACS directory | ||
file: | ||
path: "{{ ha_path }}/custom_components/hacs" | ||
state: absent | ||
|
||
- name: Create HACS directory | ||
file: | ||
path: "{{ ha_path }}/custom_components/hacs" | ||
state: directory | ||
mode: '0755' | ||
|
||
- name: Download and unpack HACS | ||
unarchive: | ||
src: https://github.com/hacs/integration/releases/latest/download/hacs.zip | ||
dest: "{{ ha_path }}/custom_components/hacs" | ||
remote_src: yes | ||
|
||
- name: Restart Home Assistant | ||
shell: | | ||
ha core restart | ||
args: | ||
warn: no # noqa 301 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
- name: Install OS package prereqs # noqa 403 | ||
apt: | ||
name: | ||
- unzip | ||
state: present | ||
update_cache: yes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
localhost | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
- hosts: localhost | ||
remote_user: root | ||
roles: | ||
- install_hacs |