src.nth.io/

summaryrefslogtreecommitdiff
path: root/roles/hap-nodejs/tasks/main.yaml
blob: a73eddbc1e01007da6d2b29570d7be22f058b3e3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
---

- name: install homekit apt packages
  become: yes
  apt: name="{{item}}"
  with_items: "{{hap_ubuntu_apt_packages}}"

- name: download and unarchive HAP-NodeJS
  unarchive: src="{{hap_src}}" dest="{{hap_home}}" remote_src="yes" creates="{{hap_dest}}"

- name: install npm packages
  npm: name="{{item}}" path="{{hap_dest}}"
  with_items: "{{hap_npm_packages}}"

- name: clean up accessory examples
  file: path="{{hap_dest}}/accessories" state="absent"

- name: create accessories dir
  file: path="{{hap_dest}}/accessories" state="directory"

- name: create python dir
  file: path="{{hap_dest}}/python" state="directory"

- name: install doord.py
  copy: src="../../../src/doord.py" dest="{{hap_dest}}/python/doord.py"
  notify: restart hap-nodejs service

- name: install door accessory
  copy: src="../../../src/Door_accessory.js" dest="{{hap_dest}}/accessories/Door_accessory.js"
  notify: restart hap-nodejs service

- name: build HAP-NodeJS
  npm: path="{{hap_dest}}"

- name: configure systemd service
  become: yes
  template: src="hap-nodejs.service.j2" dest="/lib/systemd/system/hap-nodejs.service"
  notify: restart hap-nodejs service

- name: ensure hap-nodejs is started
  become: yes
  systemd: name="hap-nodejs.service" enabled="yes" state="started"