40 lines
1.0 KiB
YAML
40 lines
1.0 KiB
YAML
---
|
|
- name: Create directories
|
|
file:
|
|
path: "{{ item }}"
|
|
state: directory
|
|
owner: "{{ zigbee2mqtt_user }}"
|
|
group: "{{ zigbee2mqtt_group }}"
|
|
recurse: True
|
|
with_items:
|
|
- "{{ zigbee2mqtt_base_dir }}"
|
|
become: True
|
|
become_user: root
|
|
|
|
- block:
|
|
- name: Setup zigbee2mqtt
|
|
git:
|
|
repo: "https://github.com/Koenkk/zigbee2mqtt"
|
|
dest: "{{ zigbee2mqtt_base_dir }}"
|
|
version: "{{ zigbee2mqtt_version }}"
|
|
register: __zigbee2mqtt_install
|
|
|
|
- name: Install nodejs
|
|
npm:
|
|
path: "{{ zigbee2mqtt_base_dir }}"
|
|
when: __zigbee2mqtt_install.changed
|
|
notify: __zigbee2mqtt_restart
|
|
when: zigbee2mqtt_version is version(zigbee2mqtt_current_version, ">")
|
|
become: True
|
|
become_user: "{{ zigbee2mqtt_user }}"
|
|
|
|
- block:
|
|
- name: Create systemd unit files
|
|
template:
|
|
src: "etc/systemd/system/zigbee2mqtt.service.j2"
|
|
dest: "/etc/systemd/system/zigbee2mqtt.service"
|
|
mode: 0644
|
|
notify: __openhab_restart
|
|
become: True
|
|
become_user: root
|