author | Luke Hoersten <luke@hoersten.org> |
Mon, 05 Feb 2018 20:56:12 -0600 | |
changeset 13 | 684ac329e7da |
parent 9 | 511e97bd5566 |
child 15 | 6913019b9492 |
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}}" |
|
17 |
with_items: "{{hap_ubuntu_apt_packages}}" |
|
18 |
||
19 |
- name: download and unarchive HAP-NodeJS |
|
8 | 20 |
become: yes |
21 |
become_user: "{{hap_user}}" |
|
22 |
unarchive: |
|
23 |
src: "{{hap_src}}" |
|
24 |
dest: "{{hap_dir}}" |
|
25 |
remote_src: "yes" |
|
26 |
creates: "{{hap_dest}}" |
|
27 |
owner: "{{hap_user}}" |
|
28 |
group: "{{hap_user}}" |
|
0 | 29 |
|
30 |
- name: install npm packages |
|
8 | 31 |
become: yes |
32 |
become_user: "{{hap_user}}" |
|
0 | 33 |
npm: name="{{item}}" path="{{hap_dest}}" |
34 |
with_items: "{{hap_npm_packages}}" |
|
35 |
||
36 |
- name: clean up accessory examples |
|
8 | 37 |
become: yes |
0 | 38 |
file: path="{{hap_dest}}/accessories" state="absent" |
9
511e97bd5566
Created custom automationhat role.
Luke Hoersten <luke@hoersten.org>
parents:
8
diff
changeset
|
39 |
changed_when: false |
0 | 40 |
|
41 |
- name: create accessories dir |
|
8 | 42 |
become: yes |
43 |
file: |
|
44 |
path: "{{hap_dest}}/accessories" |
|
45 |
state: "directory" |
|
46 |
owner: "{{hap_user}}" |
|
47 |
group: "{{hap_user}}" |
|
9
511e97bd5566
Created custom automationhat role.
Luke Hoersten <luke@hoersten.org>
parents:
8
diff
changeset
|
48 |
changed_when: false |
511e97bd5566
Created custom automationhat role.
Luke Hoersten <luke@hoersten.org>
parents:
8
diff
changeset
|
49 |
|
511e97bd5566
Created custom automationhat role.
Luke Hoersten <luke@hoersten.org>
parents:
8
diff
changeset
|
50 |
- name: install door accessory |
511e97bd5566
Created custom automationhat role.
Luke Hoersten <luke@hoersten.org>
parents:
8
diff
changeset
|
51 |
become: yes |
511e97bd5566
Created custom automationhat role.
Luke Hoersten <luke@hoersten.org>
parents:
8
diff
changeset
|
52 |
copy: |
511e97bd5566
Created custom automationhat role.
Luke Hoersten <luke@hoersten.org>
parents:
8
diff
changeset
|
53 |
src: "../../../src/Door_accessory.js" |
511e97bd5566
Created custom automationhat role.
Luke Hoersten <luke@hoersten.org>
parents:
8
diff
changeset
|
54 |
dest: "{{hap_dest}}/accessories/Door_accessory.js" |
511e97bd5566
Created custom automationhat role.
Luke Hoersten <luke@hoersten.org>
parents:
8
diff
changeset
|
55 |
owner: "{{hap_user}}" |
511e97bd5566
Created custom automationhat role.
Luke Hoersten <luke@hoersten.org>
parents:
8
diff
changeset
|
56 |
group: "{{hap_user}}" |
511e97bd5566
Created custom automationhat role.
Luke Hoersten <luke@hoersten.org>
parents:
8
diff
changeset
|
57 |
notify: restart hap-nodejs service |
511e97bd5566
Created custom automationhat role.
Luke Hoersten <luke@hoersten.org>
parents:
8
diff
changeset
|
58 |
changed_when: false |
0 | 59 |
|
60 |
- name: create python dir |
|
8 | 61 |
become: yes |
62 |
file: |
|
63 |
path: "{{hap_dest}}/python" |
|
64 |
state: "directory" |
|
65 |
owner: "{{hap_user}}" |
|
66 |
group: "{{hap_user}}" |
|
0 | 67 |
|
68 |
- name: install doord.py |
|
8 | 69 |
become: yes |
70 |
copy: |
|
71 |
src: "../../../src/doord.py" |
|
72 |
dest: "{{hap_dest}}/python/doord.py" |
|
73 |
owner: "{{hap_user}}" |
|
74 |
group: "{{hap_user}}" |
|
75 |
mode: "0755" |
|
0 | 76 |
notify: restart hap-nodejs service |
77 |
||
78 |
- name: build HAP-NodeJS |
|
8 | 79 |
become: yes |
80 |
become_user: "{{hap_user}}" |
|
7
55b8db128364
Removed unneeded npm command module.
Luke Hoersten <luke@hoersten.org>
parents:
1
diff
changeset
|
81 |
npm: path="{{hap_dest}}" |
0 | 82 |
|
83 |
- name: configure systemd service |
|
84 |
become: yes |
|
85 |
template: src="hap-nodejs.service.j2" dest="/lib/systemd/system/hap-nodejs.service" |
|
86 |
notify: restart hap-nodejs service |
|
87 |
||
88 |
- name: ensure hap-nodejs is started |
|
89 |
become: yes |
|
90 |
systemd: name="hap-nodejs.service" enabled="yes" state="started" |