72 lines
2.2 KiB
YAML
72 lines
2.2 KiB
YAML
---
|
|
- hosts: home-assistant
|
|
tasks:
|
|
- name: Remove automations directory
|
|
file:
|
|
path: '{{ pwd_config }}/automations'
|
|
state: absent
|
|
- name: Create build directory
|
|
delegate_to: localhost
|
|
file:
|
|
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: './build/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.office
|
|
name: Table lamp
|
|
- 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
|
|
src: ./scripts
|
|
dest: '{{ pwd_config }}/scripts.yaml'
|
|
- name: Copy configuration
|
|
copy:
|
|
src: configuration/configuration.yaml
|
|
dest: '{{ pwd_config }}/configuration.yaml'
|
|
- name: Copy alert
|
|
copy:
|
|
src: configuration/alert.yaml
|
|
dest: '{{ pwd_config }}/alert.yaml'
|
|
- name: Copy customize
|
|
copy:
|
|
src: configuration/customize.yaml
|
|
dest: '{{ pwd_config }}/customize.yaml'
|
|
- name: Copy groups
|
|
copy:
|
|
src: configuration/groups.yaml
|
|
dest: '{{ pwd_config }}/groups.yaml'
|
|
- name: Copy secrets
|
|
copy:
|
|
src: configuration/secrets.yaml
|
|
dest: '{{ pwd_config }}/secrets.yaml'
|
|
- name: Copy scripts
|
|
copy:
|
|
src: python_scripts
|
|
dest: '{{ pwd_config }}'
|
|
directory_mode: yes |