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