- Add '--skip-check' option to update.py to skip dotfiles update checks. - Update playbook.yml and symlinks.yml to use 'inventory_hostname' for host checks. - Refactor service task inclusions in server.yml for better readability and maintainability. - Add new Home Assistant service with corresponding docker-compose configuration. - Update various service YAML files to use dynamic paths based on inventory_hostname. - Add tags for service tasks to improve organization and execution control. - Remove obsolete services.yml file.
37 lines
1.2 KiB
YAML
37 lines
1.2 KiB
YAML
---
|
|
- name: Deploy Home Assistant service
|
|
block:
|
|
- name: Set Home Assistant directories
|
|
ansible.builtin.set_fact:
|
|
homeassistant_data_dir: "/mnt/services/homeassistant"
|
|
homeassistant_service_dir: "{{ ansible_env.HOME }}/services/homeassistant"
|
|
|
|
- name: Create Home Assistant directories
|
|
ansible.builtin.file:
|
|
path: "{{ homeassistant_dir }}"
|
|
state: directory
|
|
mode: "0755"
|
|
loop:
|
|
- "{{ homeassistant_data_dir }}"
|
|
- "{{ homeassistant_service_dir }}"
|
|
loop_control:
|
|
loop_var: homeassistant_dir
|
|
|
|
- name: Deploy Home Assistant docker-compose.yml
|
|
ansible.builtin.template:
|
|
src: docker-compose.yml.j2
|
|
dest: "{{ homeassistant_service_dir }}/docker-compose.yml"
|
|
mode: "0644"
|
|
register: homeassistant_compose
|
|
|
|
- name: Stop Home Assistant service
|
|
ansible.builtin.command: docker compose -f "{{ homeassistant_service_dir }}/docker-compose.yml" down --remove-orphans
|
|
when: homeassistant_compose.changed
|
|
|
|
- name: Start Home Assistant service
|
|
ansible.builtin.command: docker compose -f "{{ homeassistant_service_dir }}/docker-compose.yml" up -d
|
|
when: homeassistant_compose.changed
|
|
tags:
|
|
- services
|
|
- homeassistant
|