64 lines
1.6 KiB
YAML
64 lines
1.6 KiB
YAML
|
- name: Download NodeSource repository gpg key
|
||
|
get_url:
|
||
|
url: https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key
|
||
|
dest: /usr/share/keyrings/nodesource.asc
|
||
|
|
||
|
- name: Add NodeSource nodejs repository
|
||
|
apt_repository:
|
||
|
repo: deb [arch=amd64 signed-by=/usr/share/keyrings/nodesource.asc] https://deb.nodesource.com/node_20.x nodistro main
|
||
|
|
||
|
- name: Install required packages
|
||
|
apt:
|
||
|
update_cache: true
|
||
|
name:
|
||
|
- git
|
||
|
- nodejs
|
||
|
|
||
|
- name: Clone a zigbee2mqtt git repository
|
||
|
git:
|
||
|
repo: https://github.com/Koenkk/zigbee2mqtt.git
|
||
|
dest: /opt/zigbee2mqtt
|
||
|
depth: 1
|
||
|
update: false
|
||
|
register: git_clone
|
||
|
|
||
|
- name: Install zigbee2mqtt
|
||
|
shell:
|
||
|
chdir: /opt/zigbee2mqtt
|
||
|
cmd: npm ci && npm run build
|
||
|
when: git_clone.changed
|
||
|
notify: Restart zigbee2mqtt
|
||
|
|
||
|
- name: Enable zigbee2mqtt home-assistant integration
|
||
|
lineinfile:
|
||
|
path: /opt/zigbee2mqtt/data/configuration.yaml
|
||
|
line: "homeassistant: true"
|
||
|
regexp: '^homeassistant:'
|
||
|
notify: Restart zigbee2mqtt
|
||
|
|
||
|
- name: Enable zigbee2mqtt frontend
|
||
|
lineinfile:
|
||
|
path: /opt/zigbee2mqtt/data/configuration.yaml
|
||
|
line: 'frontend: true'
|
||
|
regexp: '^frontend:'
|
||
|
notify: Restart zigbee2mqtt
|
||
|
|
||
|
- name: Disable zigbee2mqtt network join
|
||
|
lineinfile:
|
||
|
path: /opt/zigbee2mqtt/data/configuration.yaml
|
||
|
line: 'permit_join: false'
|
||
|
regexp: '^permit_join:'
|
||
|
notify: Restart zigbee2mqtt
|
||
|
|
||
|
- name: Install zigbee2mqtt systemd unit
|
||
|
template:
|
||
|
src: zigbee2mqtt.service
|
||
|
dest: /etc/systemd/system/zigbee2mqtt.service
|
||
|
mode: 0644
|
||
|
notify: Restart zigbee2mqtt
|
||
|
|
||
|
- name: Enable zigbee2mqtt service
|
||
|
systemd:
|
||
|
name: zigbee2mqtt
|
||
|
daemon_reload: yes
|
||
|
enabled: yes
|