ddvic-server/playbooks/110-install-homeassistant.yml

46 lines
1.1 KiB
YAML
Raw Normal View History

---
- name: Install home assitant
hosts: all
become: true
strategy: free
gather_facts: true
become_method: sudo
vars:
- hass_dir: /docker/homeassistant
- hass_config: "{{ hass_dir }}/config"
- hass_docker_compose: "{{ hass_dir }}/docker-compose.yml"
tasks:
- name: "Check if {{ hass_dir }} exists, otherwise create it"
ansible.builtin.file:
path: "{{ hass_dir }}"
state: directory
owner: root
group: root
mode: 0755
- name: "Check if {{ hass_config }} exists, otherwise create it"
ansible.builtin.file:
path: "{{ hass_config }}"
state: directory
owner: root
group: root
mode: 0755
- name: Copy docker-compose jinja templaate to host
ansible.builtin.template:
src: templates/homeassistant/docker-compose.yml.j2
dest: "{{ hass_docker_compose }}"
owner: root
group: root
mode: 0600
- name: Start home assistant
docker_compose:
project_src: "{{ hass_dir }}"
state: present
pull: true
recreate: smart
build: true
services: homeassistant