--- - block: - name: Ensure service directory exists file: path: "{{ zigbee2mqtt_service_directory }}" mode: 0750 state: directory - name: Create bind mount source directory file: path: "{{ item.name }}" mode: 0750 state: directory loop: "{{ zigbee2mqtt_volumes }}" loop_control: label: "{{ item.name }}" when: item.bind | bool - name: Deploy compose file to '{{ zigbee2mqtt_service_directory }}' template: src: "services/zigbee2mqtt_compose.yml.j2" dest: "{{ zigbee2mqtt_service_directory }}/docker-compose.yml" owner: root group: root mode: 0640 validate: "docker-compose -f %s config -q" - name: Deploy configuration file template: src: "zigbee2mqtt/data/configuration.yaml.j2" dest: "{{ zigbee2mqtt_data_volume }}/configuration.yaml" mode: 0600 notify: __zigbee2mqtt_restart - name: Ensure device files exists file: path: "{{ item }}" mode: 0640 state: touch access_time: preserve modification_time: preserve loop: - "{{ zigbee2mqtt_data_volume }}/devices.yaml" - "{{ zigbee2mqtt_data_volume }}/groups.yaml" - name: Ensure service is up and running docker_compose: project_src: "{{ zigbee2mqtt_service_directory }}" pull: yes remove_orphans: yes stopped: "{{ zigbee2mqtt_service_stopped }}" state: present become: True become_user: root