roles/hap-nodejs/tasks/main.yaml
author Luke Hoersten <luke@hoersten.org>
Mon, 29 Jan 2018 20:45:09 -0600
changeset 5 8e3d93a69233
parent 1 bc6a0f25a229
child 7 55b8db128364
permissions -rw-r--r--
Disabled rpi swap because it kills the sd cards.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
30d8bcb1ebb4 Initial public commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     1
---
30d8bcb1ebb4 Initial public commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     2
30d8bcb1ebb4 Initial public commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     3
- name: install homekit apt packages
30d8bcb1ebb4 Initial public commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     4
  become: yes
30d8bcb1ebb4 Initial public commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     5
  apt: name="{{item}}"
30d8bcb1ebb4 Initial public commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     6
  with_items: "{{hap_ubuntu_apt_packages}}"
30d8bcb1ebb4 Initial public commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     7
30d8bcb1ebb4 Initial public commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     8
- name: download and unarchive HAP-NodeJS
30d8bcb1ebb4 Initial public commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     9
  unarchive: src="{{hap_src}}" dest="{{hap_home}}" remote_src="yes" creates="{{hap_dest}}"
30d8bcb1ebb4 Initial public commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    10
30d8bcb1ebb4 Initial public commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    11
- name: install npm packages
30d8bcb1ebb4 Initial public commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    12
  npm: name="{{item}}" path="{{hap_dest}}"
30d8bcb1ebb4 Initial public commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    13
  with_items: "{{hap_npm_packages}}"
30d8bcb1ebb4 Initial public commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    14
30d8bcb1ebb4 Initial public commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    15
- name: clean up accessory examples
30d8bcb1ebb4 Initial public commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    16
  file: path="{{hap_dest}}/accessories" state="absent"
30d8bcb1ebb4 Initial public commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    17
30d8bcb1ebb4 Initial public commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    18
- name: create accessories dir
30d8bcb1ebb4 Initial public commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    19
  file: path="{{hap_dest}}/accessories" state="directory"
30d8bcb1ebb4 Initial public commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    20
30d8bcb1ebb4 Initial public commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    21
- name: create python dir
30d8bcb1ebb4 Initial public commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    22
  file: path="{{hap_dest}}/python" state="directory"
30d8bcb1ebb4 Initial public commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    23
30d8bcb1ebb4 Initial public commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    24
- name: install doord.py
1
bc6a0f25a229 Pulled out src files.
Luke Hoersten <luke@hoersten.org>
parents: 0
diff changeset
    25
  copy: src="../../../src/doord.py" dest="{{hap_dest}}/python/doord.py"
0
30d8bcb1ebb4 Initial public commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    26
  notify: restart hap-nodejs service
30d8bcb1ebb4 Initial public commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    27
30d8bcb1ebb4 Initial public commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    28
- name: install door accessory
1
bc6a0f25a229 Pulled out src files.
Luke Hoersten <luke@hoersten.org>
parents: 0
diff changeset
    29
  copy: src="../../../src/Door_accessory.js" dest="{{hap_dest}}/accessories/Door_accessory.js"
0
30d8bcb1ebb4 Initial public commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    30
  notify: restart hap-nodejs service
30d8bcb1ebb4 Initial public commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    31
30d8bcb1ebb4 Initial public commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    32
- name: build HAP-NodeJS
30d8bcb1ebb4 Initial public commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    33
  command: "npm install"
30d8bcb1ebb4 Initial public commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    34
  args:
30d8bcb1ebb4 Initial public commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    35
    chdir: "{{hap_dest}}"
30d8bcb1ebb4 Initial public commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    36
  changed_when: false
30d8bcb1ebb4 Initial public commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    37
30d8bcb1ebb4 Initial public commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    38
- name: configure systemd service
30d8bcb1ebb4 Initial public commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    39
  become: yes
30d8bcb1ebb4 Initial public commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    40
  template: src="hap-nodejs.service.j2" dest="/lib/systemd/system/hap-nodejs.service"
30d8bcb1ebb4 Initial public commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    41
  notify: restart hap-nodejs service
30d8bcb1ebb4 Initial public commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    42
30d8bcb1ebb4 Initial public commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    43
- name: ensure hap-nodejs is started
30d8bcb1ebb4 Initial public commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    44
  become: yes
30d8bcb1ebb4 Initial public commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    45
  systemd: name="hap-nodejs.service" enabled="yes" state="started"