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