diff --git a/.gitignore b/.gitignore index bbcbf7e..5bc225c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ .idea/ -configuration/secrets.yaml \ No newline at end of file +configuration/secrets.yaml + +build/ \ No newline at end of file diff --git a/configuration/configuration.yaml b/configuration/configuration.yaml index 44f9750..3e1384f 100644 --- a/configuration/configuration.yaml +++ b/configuration/configuration.yaml @@ -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: diff --git a/home-assistant.yml b/home-assistant.yml index b179336..73c78bb 100644 --- a/home-assistant.yml +++ b/home-assistant.yml @@ -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