xoxys.homeassistant_docker/tasks/setup.yml
Robert Kaussow c8edca4d5e
Some checks failed
continuous-integration/drone/push Build is failing
refactor: rewrite role for docker deployment
2021-03-14 17:46:46 +01:00

50 lines
1.5 KiB
YAML

---
- block:
- name: Ensure service directory exists
file:
path: "{{ homeassistant_service_directory }}"
mode: 0750
state: directory
- name: Create bind mount source directory
file:
path: "{{ item.name }}"
mode: 0750
state: directory
loop: "{{ homeassistant_volumes }}"
loop_control:
label: "{{ item.name }}"
when: item.bind | bool
- name: Deploy compose file to '{{ homeassistant_service_directory }}'
template:
src: "services/homeassistant_compose.yml.j2"
dest: "{{ homeassistant_service_directory }}/docker-compose.yml"
owner: root
group: root
mode: 0640
validate: "docker-compose -f %s config -q"
- name: Patch /boot/cmdline
copy:
content: "{{ homeassistant_cmdline_content }}"
dest: /boot/cmdline.txt
when: homeassistant_cmdline_override_enabled | bool
- name: Exclude serial devices from ModemManager
template:
src: "etc/udev/rules.d/99-mm-disable.rules.j2"
dest: "/etc/udev/rules.d/99-mm-disable.rules"
when: homeassistant_exclude_modemmanager | bool
notify: __udev_reload
- name: Ensure service is up and running
docker_compose:
project_src: "{{ homeassistant_service_directory }}"
pull: yes
remove_orphans: yes
stopped: "{{ homeassistant_service_stopped }}"
state: present
become: True
become_user: root