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

4
.gitignore vendored
View File

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

View File

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

View File

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