Automatically push config change to ha instance
This commit is contained in:
parent
207b269227
commit
aab053abcf
2
ansible.cfg
Normal file
2
ansible.cfg
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
[defaults]
|
||||||
|
inventory = ./inventory
|
@ -1,10 +1,18 @@
|
|||||||
---
|
---
|
||||||
- hosts: localhost
|
- hosts: home-assistant
|
||||||
tasks:
|
tasks:
|
||||||
|
- name: Remove automations directory
|
||||||
|
file:
|
||||||
|
path: '{{ pwd_config }}/automations'
|
||||||
|
state: absent
|
||||||
|
- name: Create automations directory
|
||||||
|
file:
|
||||||
|
path: '{{ pwd_config }}/automations'
|
||||||
|
state: directory
|
||||||
- name: Build lights automations
|
- name: Build lights automations
|
||||||
template:
|
template:
|
||||||
src: lights.yaml.j2
|
src: lights.yaml.j2
|
||||||
dest: configuration/automations/lights.yaml
|
dest: '{{ pwd_config }}/automations/lights.yaml'
|
||||||
vars:
|
vars:
|
||||||
lights:
|
lights:
|
||||||
- entityId: light.bathroom_lights
|
- entityId: light.bathroom_lights
|
||||||
@ -19,7 +27,13 @@
|
|||||||
name: Desk Lightbar
|
name: Desk Lightbar
|
||||||
- entityId: light.table_lamp
|
- entityId: light.table_lamp
|
||||||
name: Table lamp
|
name: Table lamp
|
||||||
|
- name: Copy rest of automations
|
||||||
|
copy:
|
||||||
|
src: configuration/automations
|
||||||
|
dest: '{{ pwd_config }}'
|
||||||
|
directory_mode: yes
|
||||||
- name: Concat scripts
|
- name: Concat scripts
|
||||||
ansible.builtin.assemble:
|
ansible.builtin.assemble:
|
||||||
src: scripts
|
remote_src: no
|
||||||
dest: configuration/scripts.yaml
|
src: ./scripts
|
||||||
|
dest: '{{ pwd_config }}/scripts.yaml'
|
||||||
|
8
inventory/hosts.yml
Normal file
8
inventory/hosts.yml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
---
|
||||||
|
all:
|
||||||
|
hosts:
|
||||||
|
home-assistant:
|
||||||
|
gather_facts: False
|
||||||
|
ansible_user: root
|
||||||
|
ansible_port: 2222
|
||||||
|
pwd_config: /config
|
25
localhost.yml
Normal file
25
localhost.yml
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
---
|
||||||
|
- hosts: localhost
|
||||||
|
tasks:
|
||||||
|
- name: Build lights automations
|
||||||
|
template:
|
||||||
|
src: lights.yaml.j2
|
||||||
|
dest: configuration/automations/lights.yaml
|
||||||
|
vars:
|
||||||
|
lights:
|
||||||
|
- entityId: light.bathroom_lights
|
||||||
|
name: Bathroom Lights
|
||||||
|
- entityId: light.kitchen_lights
|
||||||
|
name: Kitchen Lights
|
||||||
|
- entityId: light.shower_lights
|
||||||
|
name: Shower Lights
|
||||||
|
- entityId: light.couch_lights
|
||||||
|
name: Couch Lights
|
||||||
|
- entityId: light.desk_lightbar
|
||||||
|
name: Desk Lightbar
|
||||||
|
- entityId: light.table_lamp
|
||||||
|
name: Table lamp
|
||||||
|
- name: Concat scripts
|
||||||
|
ansible.builtin.assemble:
|
||||||
|
src: scripts
|
||||||
|
dest: configuration/scripts.yaml
|
Loading…
Reference in New Issue
Block a user