1
0

Move automations to single file

This commit is contained in:
Przemek Grondek 2021-12-18 13:34:17 +01:00
parent 479fa18e40
commit ee9017becd
3 changed files with 20 additions and 10 deletions

2
.gitignore vendored
View File

@ -1,3 +1,5 @@
.idea/
configuration/secrets.yaml
build/

View File

@ -1,5 +1,5 @@
# Configure a default setup of Home Assistant (frontend, api, etc)
automation: !include_dir_merge_list automations/
automation: !include automations.yaml
#cloud:
config:
counter:

View File

@ -5,14 +5,22 @@
file:
path: '{{ pwd_config }}/automations'
state: absent
- name: Create automations directory
- name: Create build directory
delegate_to: localhost
file:
path: '{{ pwd_config }}/automations'
path: './build/automations'
state: directory
- name: Concat automation
delegate_to: localhost
ansible.builtin.assemble:
remote_src: no
src: './configuration/automations'
dest: './build/automations/automations-base.yaml'
- name: Build lights automations
delegate_to: localhost
template:
src: lights.yaml.j2
dest: '{{ pwd_config }}/automations/lights.yaml'
dest: './build/automations/lights.yaml'
vars:
lights:
- entityId: light.bathroom_lights
@ -27,11 +35,11 @@
name: Desk Lightbar
- entityId: light.office
name: Table lamp
- name: Copy rest of automations
copy:
src: configuration/automations
dest: '{{ pwd_config }}'
directory_mode: yes
- name: Concat automation 2
ansible.builtin.assemble:
remote_src: no
src: './build/automations/'
dest: '{{ pwd_config }}/automations.yaml'
- name: Concat scripts
ansible.builtin.assemble:
remote_src: no