2023-05-20 17:23:11 +02:00
|
|
|
---
|
|
|
|
|
|
|
|
- name: Check home_assistant directory exist
|
|
|
|
ansible.builtin.file:
|
|
|
|
path: home_assistant
|
|
|
|
state: directory
|
|
|
|
|
|
|
|
- name: Copy template conf
|
|
|
|
ansible.builtin.template:
|
|
|
|
src: "{{ item.src }}"
|
|
|
|
dest: "home_assistant/{{ item.dest }}"
|
|
|
|
loop:
|
|
|
|
- { src: 'docker-compose.yml.j2', dest: 'docker-compose.yml' }
|
|
|
|
register: home_assistant_copy_templates_results
|
|
|
|
|
2023-05-21 10:57:56 +02:00
|
|
|
- name: Update and restart container
|
2024-07-14 21:39:23 +02:00
|
|
|
community.docker.docker_compose_v2:
|
2023-05-20 17:23:11 +02:00
|
|
|
project_src: home_assistant
|
|
|
|
state: present
|
2024-07-14 21:39:23 +02:00
|
|
|
pull: always
|
2023-05-21 10:57:56 +02:00
|
|
|
restarted: "{{ home_assistant_copy_templates_results.changed }}"
|
2023-05-20 17:23:11 +02:00
|
|
|
become: true
|