blob: 9af56565b8850561c9afbe31c6686388a4fbd16e (
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
---
- name: create hap-nodejs user
become: yes
user:
name: "{{hap_user}}"
comment: "HAP-NodeJS"
groups: "spi,i2c,gpio"
shell: "/bin/false"
home: "{{hap_dir}}"
move_home: yes
notify: restart hap-nodejs service
- name: install homekit apt packages
become: yes
apt: name="{{item}}"
with_items:
- "libavahi-compat-libdnssd-dev"
- "nodejs-legacy"
- "npm"
notify: restart hap-nodejs service
- name: download and unarchive HAP-NodeJS
become: yes
become_user: "{{hap_user}}"
unarchive:
src: "{{hap_src}}"
dest: "{{hap_dir}}"
remote_src: "yes"
creates: "{{hap_dest}}"
owner: "{{hap_user}}"
group: "{{hap_user}}"
notify: restart hap-nodejs service
- name: install python-shell npm packages
become: yes
npm: name="python-shell" global="yes"
notify: restart hap-nodejs service
- name: clean up accessory examples
become: yes
file: path="{{hap_dest}}/accessories" state="absent"
changed_when: false
- name: create accessories dir
become: yes
file:
path: "{{hap_dest}}/accessories"
state: "directory"
owner: "{{hap_user}}"
group: "{{hap_user}}"
changed_when: false
- name: install door accessory
become: yes
copy:
src: "../../../src/Door_accessory.js"
dest: "{{hap_dest}}/accessories/Door_accessory.js"
owner: "{{hap_user}}"
group: "{{hap_user}}"
notify: restart hap-nodejs service
changed_when: false
- name: create python dir
become: yes
file:
path: "{{hap_dest}}/python"
state: "directory"
owner: "{{hap_user}}"
group: "{{hap_user}}"
- name: install doord.py
become: yes
copy:
src: "../../../src/doord.py"
dest: "{{hap_dest}}/python/doord.py"
owner: "{{hap_user}}"
group: "{{hap_user}}"
mode: "0755"
notify: restart hap-nodejs service
- name: build HAP-NodeJS
become: yes
become_user: "{{hap_user}}"
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"
|