author | Luke Hoersten <luke@hoersten.org> |
Thu, 22 Feb 2018 22:09:20 -0600 | |
changeset 16 | 23b704e271bb |
parent 15 | 6913019b9492 |
child 17 | 69a7d69de562 |
permissions | -rw-r--r-- |
0 | 1 |
--- |
2 |
||
8 | 3 |
- name: create hap-nodejs user |
4 |
become: yes |
|
5 |
user: |
|
6 |
name: "{{hap_user}}" |
|
7 |
comment: "HAP-NodeJS" |
|
8 |
groups: "spi,i2c,gpio" |
|
9 |
shell: "/bin/false" |
|
10 |
home: "{{hap_dir}}" |
|
11 |
move_home: yes |
|
12 |
notify: restart hap-nodejs service |
|
13 |
||
0 | 14 |
- name: install homekit apt packages |
15 |
become: yes |
|
16 |
apt: name="{{item}}" |
|
15
6913019b9492
Removed nodejs role. Using apt now.
Luke Hoersten <luke@hoersten.org>
parents:
9
diff
changeset
|
17 |
with_items: |
6913019b9492
Removed nodejs role. Using apt now.
Luke Hoersten <luke@hoersten.org>
parents:
9
diff
changeset
|
18 |
- "libavahi-compat-libdnssd-dev" |
6913019b9492
Removed nodejs role. Using apt now.
Luke Hoersten <luke@hoersten.org>
parents:
9
diff
changeset
|
19 |
- "nodejs-legacy" |
6913019b9492
Removed nodejs role. Using apt now.
Luke Hoersten <luke@hoersten.org>
parents:
9
diff
changeset
|
20 |
- "npm" |
16 | 21 |
notify: restart hap-nodejs service |
0 | 22 |
|
23 |
- name: download and unarchive HAP-NodeJS |
|
8 | 24 |
become: yes |
25 |
become_user: "{{hap_user}}" |
|
26 |
unarchive: |
|
27 |
src: "{{hap_src}}" |
|
28 |
dest: "{{hap_dir}}" |
|
29 |
remote_src: "yes" |
|
30 |
creates: "{{hap_dest}}" |
|
31 |
owner: "{{hap_user}}" |
|
32 |
group: "{{hap_user}}" |
|
16 | 33 |
notify: restart hap-nodejs service |
0 | 34 |
|
16 | 35 |
- name: install python-shell npm packages |
8 | 36 |
become: yes |
16 | 37 |
npm: name="python-shell" global="yes" |
38 |
notify: restart hap-nodejs service |
|
0 | 39 |
|
40 |
- name: clean up accessory examples |
|
8 | 41 |
become: yes |
0 | 42 |
file: path="{{hap_dest}}/accessories" state="absent" |
9
511e97bd5566
Created custom automationhat role.
Luke Hoersten <luke@hoersten.org>
parents:
8
diff
changeset
|
43 |
changed_when: false |
0 | 44 |
|
45 |
- name: create accessories dir |
|
8 | 46 |
become: yes |
47 |
file: |
|
48 |
path: "{{hap_dest}}/accessories" |
|
49 |
state: "directory" |
|
50 |
owner: "{{hap_user}}" |
|
51 |
group: "{{hap_user}}" |
|
9
511e97bd5566
Created custom automationhat role.
Luke Hoersten <luke@hoersten.org>
parents:
8
diff
changeset
|
52 |
changed_when: false |
511e97bd5566
Created custom automationhat role.
Luke Hoersten <luke@hoersten.org>
parents:
8
diff
changeset
|
53 |
|
511e97bd5566
Created custom automationhat role.
Luke Hoersten <luke@hoersten.org>
parents:
8
diff
changeset
|
54 |
- name: install door accessory |
511e97bd5566
Created custom automationhat role.
Luke Hoersten <luke@hoersten.org>
parents:
8
diff
changeset
|
55 |
become: yes |
511e97bd5566
Created custom automationhat role.
Luke Hoersten <luke@hoersten.org>
parents:
8
diff
changeset
|
56 |
copy: |
511e97bd5566
Created custom automationhat role.
Luke Hoersten <luke@hoersten.org>
parents:
8
diff
changeset
|
57 |
src: "../../../src/Door_accessory.js" |
511e97bd5566
Created custom automationhat role.
Luke Hoersten <luke@hoersten.org>
parents:
8
diff
changeset
|
58 |
dest: "{{hap_dest}}/accessories/Door_accessory.js" |
511e97bd5566
Created custom automationhat role.
Luke Hoersten <luke@hoersten.org>
parents:
8
diff
changeset
|
59 |
owner: "{{hap_user}}" |
511e97bd5566
Created custom automationhat role.
Luke Hoersten <luke@hoersten.org>
parents:
8
diff
changeset
|
60 |
group: "{{hap_user}}" |
511e97bd5566
Created custom automationhat role.
Luke Hoersten <luke@hoersten.org>
parents:
8
diff
changeset
|
61 |
notify: restart hap-nodejs service |
511e97bd5566
Created custom automationhat role.
Luke Hoersten <luke@hoersten.org>
parents:
8
diff
changeset
|
62 |
changed_when: false |
0 | 63 |
|
64 |
- name: create python dir |
|
8 | 65 |
become: yes |
66 |
file: |
|
67 |
path: "{{hap_dest}}/python" |
|
68 |
state: "directory" |
|
69 |
owner: "{{hap_user}}" |
|
70 |
group: "{{hap_user}}" |
|
0 | 71 |
|
72 |
- name: install doord.py |
|
8 | 73 |
become: yes |
74 |
copy: |
|
75 |
src: "../../../src/doord.py" |
|
76 |
dest: "{{hap_dest}}/python/doord.py" |
|
77 |
owner: "{{hap_user}}" |
|
78 |
group: "{{hap_user}}" |
|
79 |
mode: "0755" |
|
0 | 80 |
notify: restart hap-nodejs service |
81 |
||
82 |
- name: build HAP-NodeJS |
|
8 | 83 |
become: yes |
84 |
become_user: "{{hap_user}}" |
|
7
55b8db128364
Removed unneeded npm command module.
Luke Hoersten <luke@hoersten.org>
parents:
1
diff
changeset
|
85 |
npm: path="{{hap_dest}}" |
0 | 86 |
|
87 |
- name: configure systemd service |
|
88 |
become: yes |
|
89 |
template: src="hap-nodejs.service.j2" dest="/lib/systemd/system/hap-nodejs.service" |
|
90 |
notify: restart hap-nodejs service |
|
91 |
||
92 |
- name: ensure hap-nodejs is started |
|
93 |
become: yes |
|
94 |
systemd: name="hap-nodejs.service" enabled="yes" state="started" |