roles/hap-nodejs/tasks/main.yaml
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--
Minor fixes.
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
8
e7007d23a144 Created hap-nodejs user.
Luke Hoersten <luke@hoersten.org>
parents: 7
diff changeset
     3
- name: create hap-nodejs user
e7007d23a144 Created hap-nodejs user.
Luke Hoersten <luke@hoersten.org>
parents: 7
diff changeset
     4
  become: yes
e7007d23a144 Created hap-nodejs user.
Luke Hoersten <luke@hoersten.org>
parents: 7
diff changeset
     5
  user:
e7007d23a144 Created hap-nodejs user.
Luke Hoersten <luke@hoersten.org>
parents: 7
diff changeset
     6
    name: "{{hap_user}}"
e7007d23a144 Created hap-nodejs user.
Luke Hoersten <luke@hoersten.org>
parents: 7
diff changeset
     7
    comment: "HAP-NodeJS"
e7007d23a144 Created hap-nodejs user.
Luke Hoersten <luke@hoersten.org>
parents: 7
diff changeset
     8
    groups: "spi,i2c,gpio"
e7007d23a144 Created hap-nodejs user.
Luke Hoersten <luke@hoersten.org>
parents: 7
diff changeset
     9
    shell: "/bin/false"
e7007d23a144 Created hap-nodejs user.
Luke Hoersten <luke@hoersten.org>
parents: 7
diff changeset
    10
    home: "{{hap_dir}}"
e7007d23a144 Created hap-nodejs user.
Luke Hoersten <luke@hoersten.org>
parents: 7
diff changeset
    11
    move_home: yes
e7007d23a144 Created hap-nodejs user.
Luke Hoersten <luke@hoersten.org>
parents: 7
diff changeset
    12
  notify: restart hap-nodejs service
e7007d23a144 Created hap-nodejs user.
Luke Hoersten <luke@hoersten.org>
parents: 7
diff changeset
    13
0
30d8bcb1ebb4 Initial public commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    14
- name: install homekit apt packages
30d8bcb1ebb4 Initial public commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    15
  become: yes
30d8bcb1ebb4 Initial public commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    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
23b704e271bb Minor fixes.
Luke Hoersten <luke@hoersten.org>
parents: 15
diff changeset
    21
  notify: restart hap-nodejs service
0
30d8bcb1ebb4 Initial public commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    22
30d8bcb1ebb4 Initial public commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    23
- name: download and unarchive HAP-NodeJS
8
e7007d23a144 Created hap-nodejs user.
Luke Hoersten <luke@hoersten.org>
parents: 7
diff changeset
    24
  become: yes
e7007d23a144 Created hap-nodejs user.
Luke Hoersten <luke@hoersten.org>
parents: 7
diff changeset
    25
  become_user: "{{hap_user}}"
e7007d23a144 Created hap-nodejs user.
Luke Hoersten <luke@hoersten.org>
parents: 7
diff changeset
    26
  unarchive:
e7007d23a144 Created hap-nodejs user.
Luke Hoersten <luke@hoersten.org>
parents: 7
diff changeset
    27
    src: "{{hap_src}}"
e7007d23a144 Created hap-nodejs user.
Luke Hoersten <luke@hoersten.org>
parents: 7
diff changeset
    28
    dest: "{{hap_dir}}"
e7007d23a144 Created hap-nodejs user.
Luke Hoersten <luke@hoersten.org>
parents: 7
diff changeset
    29
    remote_src: "yes"
e7007d23a144 Created hap-nodejs user.
Luke Hoersten <luke@hoersten.org>
parents: 7
diff changeset
    30
    creates: "{{hap_dest}}"
e7007d23a144 Created hap-nodejs user.
Luke Hoersten <luke@hoersten.org>
parents: 7
diff changeset
    31
    owner: "{{hap_user}}"
e7007d23a144 Created hap-nodejs user.
Luke Hoersten <luke@hoersten.org>
parents: 7
diff changeset
    32
    group: "{{hap_user}}"
16
23b704e271bb Minor fixes.
Luke Hoersten <luke@hoersten.org>
parents: 15
diff changeset
    33
  notify: restart hap-nodejs service
0
30d8bcb1ebb4 Initial public commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    34
16
23b704e271bb Minor fixes.
Luke Hoersten <luke@hoersten.org>
parents: 15
diff changeset
    35
- name: install python-shell npm packages
8
e7007d23a144 Created hap-nodejs user.
Luke Hoersten <luke@hoersten.org>
parents: 7
diff changeset
    36
  become: yes
16
23b704e271bb Minor fixes.
Luke Hoersten <luke@hoersten.org>
parents: 15
diff changeset
    37
  npm: name="python-shell" global="yes"
23b704e271bb Minor fixes.
Luke Hoersten <luke@hoersten.org>
parents: 15
diff changeset
    38
  notify: restart hap-nodejs service
0
30d8bcb1ebb4 Initial public commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    39
30d8bcb1ebb4 Initial public commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    40
- name: clean up accessory examples
8
e7007d23a144 Created hap-nodejs user.
Luke Hoersten <luke@hoersten.org>
parents: 7
diff changeset
    41
  become: yes
0
30d8bcb1ebb4 Initial public commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    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
30d8bcb1ebb4 Initial public commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    44
30d8bcb1ebb4 Initial public commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    45
- name: create accessories dir
8
e7007d23a144 Created hap-nodejs user.
Luke Hoersten <luke@hoersten.org>
parents: 7
diff changeset
    46
  become: yes
e7007d23a144 Created hap-nodejs user.
Luke Hoersten <luke@hoersten.org>
parents: 7
diff changeset
    47
  file:
e7007d23a144 Created hap-nodejs user.
Luke Hoersten <luke@hoersten.org>
parents: 7
diff changeset
    48
    path: "{{hap_dest}}/accessories"
e7007d23a144 Created hap-nodejs user.
Luke Hoersten <luke@hoersten.org>
parents: 7
diff changeset
    49
    state: "directory"
e7007d23a144 Created hap-nodejs user.
Luke Hoersten <luke@hoersten.org>
parents: 7
diff changeset
    50
    owner: "{{hap_user}}"
e7007d23a144 Created hap-nodejs user.
Luke Hoersten <luke@hoersten.org>
parents: 7
diff changeset
    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
30d8bcb1ebb4 Initial public commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    63
30d8bcb1ebb4 Initial public commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    64
- name: create python dir
8
e7007d23a144 Created hap-nodejs user.
Luke Hoersten <luke@hoersten.org>
parents: 7
diff changeset
    65
  become: yes
e7007d23a144 Created hap-nodejs user.
Luke Hoersten <luke@hoersten.org>
parents: 7
diff changeset
    66
  file:
e7007d23a144 Created hap-nodejs user.
Luke Hoersten <luke@hoersten.org>
parents: 7
diff changeset
    67
    path: "{{hap_dest}}/python"
e7007d23a144 Created hap-nodejs user.
Luke Hoersten <luke@hoersten.org>
parents: 7
diff changeset
    68
    state: "directory"
e7007d23a144 Created hap-nodejs user.
Luke Hoersten <luke@hoersten.org>
parents: 7
diff changeset
    69
    owner: "{{hap_user}}"
e7007d23a144 Created hap-nodejs user.
Luke Hoersten <luke@hoersten.org>
parents: 7
diff changeset
    70
    group: "{{hap_user}}"
0
30d8bcb1ebb4 Initial public commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    71
30d8bcb1ebb4 Initial public commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    72
- name: install doord.py
8
e7007d23a144 Created hap-nodejs user.
Luke Hoersten <luke@hoersten.org>
parents: 7
diff changeset
    73
  become: yes
e7007d23a144 Created hap-nodejs user.
Luke Hoersten <luke@hoersten.org>
parents: 7
diff changeset
    74
  copy:
e7007d23a144 Created hap-nodejs user.
Luke Hoersten <luke@hoersten.org>
parents: 7
diff changeset
    75
    src: "../../../src/doord.py"
e7007d23a144 Created hap-nodejs user.
Luke Hoersten <luke@hoersten.org>
parents: 7
diff changeset
    76
    dest: "{{hap_dest}}/python/doord.py"
e7007d23a144 Created hap-nodejs user.
Luke Hoersten <luke@hoersten.org>
parents: 7
diff changeset
    77
    owner: "{{hap_user}}"
e7007d23a144 Created hap-nodejs user.
Luke Hoersten <luke@hoersten.org>
parents: 7
diff changeset
    78
    group: "{{hap_user}}"
e7007d23a144 Created hap-nodejs user.
Luke Hoersten <luke@hoersten.org>
parents: 7
diff changeset
    79
    mode: "0755"
0
30d8bcb1ebb4 Initial public commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    80
  notify: restart hap-nodejs service
30d8bcb1ebb4 Initial public commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    81
30d8bcb1ebb4 Initial public commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    82
- name: build HAP-NodeJS
8
e7007d23a144 Created hap-nodejs user.
Luke Hoersten <luke@hoersten.org>
parents: 7
diff changeset
    83
  become: yes
e7007d23a144 Created hap-nodejs user.
Luke Hoersten <luke@hoersten.org>
parents: 7
diff changeset
    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
30d8bcb1ebb4 Initial public commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    86
30d8bcb1ebb4 Initial public commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    87
- name: configure systemd service
30d8bcb1ebb4 Initial public commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    88
  become: yes
30d8bcb1ebb4 Initial public commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    89
  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
    90
  notify: restart hap-nodejs service
30d8bcb1ebb4 Initial public commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    91
30d8bcb1ebb4 Initial public commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    92
- name: ensure hap-nodejs is started
30d8bcb1ebb4 Initial public commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    93
  become: yes
30d8bcb1ebb4 Initial public commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    94
  systemd: name="hap-nodejs.service" enabled="yes" state="started"