--- - hosts: home-assistant 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 template: src: lights.yaml.j2 dest: '{{ pwd_config }}/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: Copy rest of automations copy: src: configuration/automations dest: '{{ pwd_config }}' directory_mode: yes - name: Concat scripts ansible.builtin.assemble: remote_src: no src: ./scripts dest: '{{ pwd_config }}/scripts.yaml'