author | Luke Hoersten <luke@hoersten.org> |
Fri, 01 May 2020 16:21:21 -0500 | |
changeset 12 | 80a6e9af6aa9 |
parent 2 | 2556522a2a45 |
child 31 | c51c4eaea2a7 |
permissions | -rw-r--r-- |
0
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
1 |
--- |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
2 |
|
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
3 |
- name: create homebridge user |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
4 |
become: yes |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
5 |
user: |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
6 |
name: "{{homebridge_user}}" |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
7 |
comment: "Homebridge" |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
8 |
shell: "/bin/false" |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
9 |
home: "{{homebridge_dir}}" |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
10 |
groups: "video,spi,i2c,gpio" |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
11 |
move_home: yes |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
12 |
notify: restart homebridge service |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
13 |
|
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
14 |
- name: create homebridge directory |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
15 |
become: yes |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
16 |
file: |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
17 |
path: "{{homebridge_dir}}" |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
18 |
state: "directory" |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
19 |
owner: "{{homebridge_user}}" |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
20 |
group: "{{homebridge_user}}" |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
21 |
mode: "0755" |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
22 |
|
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
23 |
- name: install homebridge apt deps |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
24 |
become: yes |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
25 |
apt: name="{{homebridge_apt_packages}}" |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
26 |
|
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
27 |
- name: install homebridge |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
28 |
become: yes |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
29 |
npm: name="homebridge" global="yes" |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
30 |
notify: restart homebridge service |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
31 |
|
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
32 |
- name: install platform accessories |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
33 |
become: yes |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
34 |
npm: name="{{item}}" global="yes" |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
35 |
notify: restart homebridge service |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
36 |
with_items: "{{homebridge_npm_packages}}" |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
37 |
|
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
38 |
- name: configure homebridge |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
39 |
become: yes |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
40 |
template: |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
41 |
src: "config.json.j2" |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
42 |
dest: "{{homebridge_dir}}/config.json" |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
43 |
notify: restart homebridge service |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
44 |
|
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
45 |
- name: configure systemd service |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
46 |
become: yes |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
47 |
template: |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
48 |
src: "homebridge.service.j2" |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
49 |
dest: "/lib/systemd/system/homebridge.service" |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
50 |
notify: restart homebridge service |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
51 |
|
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
52 |
- name: ensure homebridge is started |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
53 |
become: yes |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
54 |
systemd: name="homebridge.service" enabled="yes" state="started" |