hass-config #32
|
@ -48,6 +48,20 @@
|
||||||
tags:
|
tags:
|
||||||
- ufw
|
- ufw
|
||||||
|
|
||||||
|
- name: copy ssh keys for {{ hass_config_repo_name }}
|
||||||
|
template:
|
||||||
|
src: "private/sshkeys/{{ item }}"
|
||||||
|
dest: "{{ systemuserlist.hass.home }}/.ssh/{{ item }}"
|
||||||
|
owner: "{{ systemuserlist.hass.uid }}"
|
||||||
|
group: "{{ systemuserlist.hass.gid }}"
|
||||||
|
mode: 0600
|
||||||
|
no_log: true
|
||||||
|
with_items:
|
||||||
|
- "{{ hass_config_repo_name }}"
|
||||||
|
- "{{ hass_config_repo_name }}.pub"
|
||||||
|
tags:
|
||||||
|
- hass-git
|
||||||
|
|
||||||
# hass + zwave
|
# hass + zwave
|
||||||
|
|
||||||
- name: create dir structure
|
- name: create dir structure
|
||||||
|
@ -57,6 +71,8 @@
|
||||||
mode: 0755
|
mode: 0755
|
||||||
owner: hass
|
owner: hass
|
||||||
group: hass
|
group: hass
|
||||||
|
tags:
|
||||||
|
- hass-dirs
|
||||||
with_items:
|
with_items:
|
||||||
- home-assistant
|
- home-assistant
|
||||||
- home-assistant/config
|
- home-assistant/config
|
||||||
|
@ -65,6 +81,32 @@
|
||||||
- zwavejs
|
- zwavejs
|
||||||
- zwavejs/app
|
- zwavejs/app
|
||||||
- zwavejs/app/store
|
- zwavejs/app/store
|
||||||
|
- git
|
||||||
|
|
||||||
|
- name: template gitconfig
|
||||||
|
template:
|
||||||
|
src: gitconfig.j2
|
||||||
|
dest: "{{ systemuserlist.hass.home }}/.gitconfig"
|
||||||
|
owner: "{{ systemuserlist.hass.uid }}"
|
||||||
|
group: "{{ systemuserlist.hass.gid }}"
|
||||||
|
mode: 0644
|
||||||
|
tags:
|
||||||
|
- hass-git
|
||||||
|
|
||||||
|
- name: set up the {{ hass_config_repo_name }} repo
|
||||||
|
git:
|
||||||
|
repo: "{{ hass_config_repo }}"
|
||||||
|
dest: "{{ systemuserlist.hass.home }}/git/{{ hass_config_repo_name }}"
|
||||||
|
version: main
|
||||||
|
clone: true
|
||||||
|
update: false
|
||||||
|
force: false
|
||||||
|
accept_newhostkey: true
|
||||||
|
key_file: "{{ systemuserlist.hass.home }}/.ssh/{{ hass_config_repo_name }}"
|
||||||
|
become_user: "{{ systemuserlist.hass.username }}"
|
||||||
|
tags:
|
||||||
|
- hass-git
|
||||||
|
- hass-git-clone
|
||||||
|
|
||||||
- name: home assistant main configuration.yaml
|
- name: home assistant main configuration.yaml
|
||||||
template:
|
template:
|
||||||
|
@ -88,6 +130,28 @@
|
||||||
tags:
|
tags:
|
||||||
- hass-config
|
- hass-config
|
||||||
|
|
||||||
|
- name: install git sync script
|
||||||
|
template:
|
||||||
|
src: git-hass-config.sh.j2
|
||||||
|
dest: /usr/local/bin/git-hass-config.sh
|
||||||
|
mode: 0775
|
||||||
|
owner: hass
|
||||||
|
group: hass
|
||||||
|
tags:
|
||||||
|
- hass-git
|
||||||
|
|
||||||
|
- name: cron file
|
||||||
|
template:
|
||||||
|
src: hass-cron.j2
|
||||||
|
dest: /etc/cron.d/hass
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: 0640
|
||||||
|
tags:
|
||||||
|
- cron
|
||||||
|
- hass-cron
|
||||||
|
- hass-git
|
||||||
|
|
||||||
# docker run --run -it -p 8091:8091 -p 3000:3000 --network
|
# docker run --run -it -p 8091:8091 -p 3000:3000 --network
|
||||||
#bridgewithdns --device /dev/ttyACM0:/dev/zwave -v
|
#bridgewithdns --device /dev/ttyACM0:/dev/zwave -v
|
||||||
# /home/ben/zwavejs:/usr/src/app/store zwavejs/zwavejs2mqtt:latest
|
# /home/ben/zwavejs:/usr/src/app/store zwavejs/zwavejs2mqtt:latest
|
||||||
|
@ -160,11 +224,14 @@
|
||||||
- type: bind
|
- type: bind
|
||||||
source: "{{ systemuserlist.hass.home }}/home-assistant/media"
|
source: "{{ systemuserlist.hass.home }}/home-assistant/media"
|
||||||
target: /usr/var/media
|
target: /usr/var/media
|
||||||
# from role: common
|
# scripts from role: common
|
||||||
# only depends on requests, which hass image has
|
# only depends on requests, which hass image has
|
||||||
- type: bind
|
- type: bind
|
||||||
source: /usr/local/bin/authelia-auth.py
|
source: /usr/local/bin/authelia-auth.py
|
||||||
target: /usr/local/bin/authelia-auth.py
|
target: /usr/local/bin/authelia-auth.py
|
||||||
|
- type: bind
|
||||||
|
source: /usr/local/bin/matrixmsg.py
|
||||||
|
target: /usr/local/bin/matrixmsg.py
|
||||||
tags:
|
tags:
|
||||||
- home-assistant
|
- home-assistant
|
||||||
- home-assistant-container
|
- home-assistant-container
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
|
# ansible: roles/hass/templates/configuration.yaml.j2
|
||||||
|
#
|
||||||
# Loads default set of integrations. Icluding the cloud crap. Do remove.
|
# Loads default set of integrations. Icluding the cloud crap. Do remove.
|
||||||
# havent gotten it to work wthough, hass doesnt load properly
|
# havent gotten it to work wthough, hass doesnt load properly
|
||||||
default_config:
|
default_config:
|
||||||
|
@ -58,12 +59,27 @@ default_config:
|
||||||
|
|
||||||
# Text to speech
|
# Text to speech
|
||||||
tts:
|
tts:
|
||||||
|
- platform: voicerss
|
||||||
|
api_key: !secret voicerss_api_key
|
||||||
- platform: google_translate
|
- platform: google_translate
|
||||||
|
|
||||||
automation: !include automations.yaml
|
automation: !include automations.yaml
|
||||||
script: !include scripts.yaml
|
script: !include scripts.yaml
|
||||||
scene: !include scenes.yaml
|
scene: !include scenes.yaml
|
||||||
|
|
||||||
|
{# calendar:
|
||||||
|
# {% for item in hass_caldav.urls %}
|
||||||
|
#
|
||||||
|
# - platform: caldav
|
||||||
|
# days: 30
|
||||||
|
# username: !secret caldav_user
|
||||||
|
# password: !secret caldav_passwd
|
||||||
|
# # {{ item.name }}
|
||||||
|
# url: {{ item.url }}
|
||||||
|
#
|
||||||
|
# {% endfor %}
|
||||||
|
#}
|
||||||
|
|
||||||
calendar:
|
calendar:
|
||||||
- platform: caldav
|
- platform: caldav
|
||||||
days: 30
|
days: 30
|
||||||
|
@ -127,7 +143,11 @@ sensor:
|
||||||
# Stadt Berlin
|
# Stadt Berlin
|
||||||
region_name: 811000000
|
region_name: 811000000
|
||||||
|
|
||||||
tts:
|
binary_sensor:
|
||||||
- platform: voicerss
|
- platform: workday
|
||||||
api_key: !secret voicerss_api_key
|
country: DE
|
||||||
- platform: google_translate
|
workdays: [mon, tue, wed, thu, fri]
|
||||||
|
excludes: [sat, sun, holiday]
|
||||||
|
|
||||||
|
shell_command:
|
||||||
|
matrixmsg: /usr/local/bin/matrixmsg.py
|
||||||
|
|
|
@ -0,0 +1,42 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
NAME_REPO="{{ hass_config_repo_name }}"
|
||||||
|
|
||||||
|
PATH_REPO="{{ systemuserlist.hass.home }}/git/${NAME_REPO}"
|
||||||
|
PATH_HASS="{{ systemuserlist.hass.home }}/home-assistant"
|
||||||
|
|
||||||
|
export GIT_SSH_COMMAND="ssh -i ~/.ssh/${NAME_REPO}"
|
||||||
|
|
||||||
|
cd $PATH_REPO
|
||||||
|
|
||||||
|
if test -n "$(git status --porcelain)" ; then
|
||||||
|
echo "repo is dirty"
|
||||||
|
git status --short
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! grep -q "secrets.y[a]ml" ${PATH_REPO}/.gitignore; then
|
||||||
|
echo "'secrets.yaml' missing from '.gitconfig'"
|
||||||
|
exit 3
|
||||||
|
fi
|
||||||
|
|
||||||
|
mkdir -p ${PATH_REPO}/config/
|
||||||
|
|
||||||
|
{% for item in hass_config_repo_files -%}
|
||||||
|
cp ${PATH_HASS}/config/{{ item }} ${PATH_REPO}/config/{{ item }}
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
if test -n "$(git status --porcelain)" ; then
|
||||||
|
{% for item in hass_config_repo_files -%}
|
||||||
|
git add config/{{ item }} > /dev/null
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
git commit -m "config updated" > /dev/null
|
||||||
|
fi
|
||||||
|
|
||||||
|
git pull --quiet
|
||||||
|
git push --quiet 2> /dev/null
|
||||||
|
|
||||||
|
# TODO: copy changes from git
|
|
@ -0,0 +1,9 @@
|
||||||
|
[user]
|
||||||
|
email = {{ systems_email }}
|
||||||
|
name = Home Assistant
|
||||||
|
|
||||||
|
[init]
|
||||||
|
defaultBranch = main
|
||||||
|
|
||||||
|
[push]
|
||||||
|
default = current
|
|
@ -0,0 +1,11 @@
|
||||||
|
# distributed from ansible
|
||||||
|
|
||||||
|
# m h dom mon dow
|
||||||
|
|
||||||
|
# sync hass config to {{ hass_config_repo }}
|
||||||
|
*/15 * * * * {{ systemuserlist.hass.username }} /usr/local/bin/git-hass-config.sh
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#
|
Loading…
Reference in New Issue