roles/hap-nodejs/tasks/main.yaml
author Luke Hoersten <luke@hoersten.org>
Mon, 30 Jul 2018 21:19:20 -0500
changeset 21 6ad3cf1d57c3
parent 18 3044f32e7f74
child 25 bc6c646f1814
permissions -rw-r--r--
Nodejs-legacy ubuntu package removed.
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}}"
17
69a7d69de562 Move python3 to hap-nodejs role.
Luke Hoersten <luke@hoersten.org>
parents: 16
diff changeset
    17
  with_items: "{{hap_apt_packages}}"
16
23b704e271bb Minor fixes.
Luke Hoersten <luke@hoersten.org>
parents: 15
diff changeset
    18
  notify: restart hap-nodejs service
0
30d8bcb1ebb4 Initial public commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    19
30d8bcb1ebb4 Initial public commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    20
- name: download and unarchive HAP-NodeJS
8
e7007d23a144 Created hap-nodejs user.
Luke Hoersten <luke@hoersten.org>
parents: 7
diff changeset
    21
  become: yes
e7007d23a144 Created hap-nodejs user.
Luke Hoersten <luke@hoersten.org>
parents: 7
diff changeset
    22
  become_user: "{{hap_user}}"
e7007d23a144 Created hap-nodejs user.
Luke Hoersten <luke@hoersten.org>
parents: 7
diff changeset
    23
  unarchive:
e7007d23a144 Created hap-nodejs user.
Luke Hoersten <luke@hoersten.org>
parents: 7
diff changeset
    24
    src: "{{hap_src}}"
e7007d23a144 Created hap-nodejs user.
Luke Hoersten <luke@hoersten.org>
parents: 7
diff changeset
    25
    dest: "{{hap_dir}}"
e7007d23a144 Created hap-nodejs user.
Luke Hoersten <luke@hoersten.org>
parents: 7
diff changeset
    26
    remote_src: "yes"
e7007d23a144 Created hap-nodejs user.
Luke Hoersten <luke@hoersten.org>
parents: 7
diff changeset
    27
    creates: "{{hap_dest}}"
e7007d23a144 Created hap-nodejs user.
Luke Hoersten <luke@hoersten.org>
parents: 7
diff changeset
    28
    owner: "{{hap_user}}"
e7007d23a144 Created hap-nodejs user.
Luke Hoersten <luke@hoersten.org>
parents: 7
diff changeset
    29
    group: "{{hap_user}}"
16
23b704e271bb Minor fixes.
Luke Hoersten <luke@hoersten.org>
parents: 15
diff changeset
    30
  notify: restart hap-nodejs service
0
30d8bcb1ebb4 Initial public commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    31
17
69a7d69de562 Move python3 to hap-nodejs role.
Luke Hoersten <luke@hoersten.org>
parents: 16
diff changeset
    32
- name: remove example accessories
8
e7007d23a144 Created hap-nodejs user.
Luke Hoersten <luke@hoersten.org>
parents: 7
diff changeset
    33
  become: yes
17
69a7d69de562 Move python3 to hap-nodejs role.
Luke Hoersten <luke@hoersten.org>
parents: 16
diff changeset
    34
  file: path="{{hap_dest}}/accessories/{{item}}" state="absent"
69a7d69de562 Move python3 to hap-nodejs role.
Luke Hoersten <luke@hoersten.org>
parents: 16
diff changeset
    35
  with_items: "{{hap_example_accessories}}"
9
511e97bd5566 Created custom automationhat role.
Luke Hoersten <luke@hoersten.org>
parents: 8
diff changeset
    36
0
30d8bcb1ebb4 Initial public commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    37
- name: build HAP-NodeJS
8
e7007d23a144 Created hap-nodejs user.
Luke Hoersten <luke@hoersten.org>
parents: 7
diff changeset
    38
  become: yes
e7007d23a144 Created hap-nodejs user.
Luke Hoersten <luke@hoersten.org>
parents: 7
diff changeset
    39
  become_user: "{{hap_user}}"
7
55b8db128364 Removed unneeded npm command module.
Luke Hoersten <luke@hoersten.org>
parents: 1
diff changeset
    40
  npm: path="{{hap_dest}}"
0
30d8bcb1ebb4 Initial public commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    41
30d8bcb1ebb4 Initial public commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    42
- name: configure systemd service
30d8bcb1ebb4 Initial public commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    43
  become: yes
30d8bcb1ebb4 Initial public commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    44
  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
    45
  notify: restart hap-nodejs service
30d8bcb1ebb4 Initial public commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    46
30d8bcb1ebb4 Initial public commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    47
- name: ensure hap-nodejs is started
30d8bcb1ebb4 Initial public commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    48
  become: yes
30d8bcb1ebb4 Initial public commit.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    49
  systemd: name="hap-nodejs.service" enabled="yes" state="started"