roles/hap-nodejs/tasks/main.yaml
changeset 8 e7007d23a144
parent 7 55b8db128364
child 9 511e97bd5566
equal deleted inserted replaced
7:55b8db128364 8:e7007d23a144
     1 ---
     1 ---
       
     2 
       
     3 - name: create hap-nodejs user
       
     4   become: yes
       
     5   user:
       
     6     name: "{{hap_user}}"
       
     7     comment: "HAP-NodeJS"
       
     8     groups: "spi,i2c,gpio"
       
     9     shell: "/bin/false"
       
    10     home: "{{hap_dir}}"
       
    11     move_home: yes
       
    12   notify: restart hap-nodejs service
     2 
    13 
     3 - name: install homekit apt packages
    14 - name: install homekit apt packages
     4   become: yes
    15   become: yes
     5   apt: name="{{item}}"
    16   apt: name="{{item}}"
     6   with_items: "{{hap_ubuntu_apt_packages}}"
    17   with_items: "{{hap_ubuntu_apt_packages}}"
     7 
    18 
     8 - name: download and unarchive HAP-NodeJS
    19 - name: download and unarchive HAP-NodeJS
     9   unarchive: src="{{hap_src}}" dest="{{hap_home}}" remote_src="yes" creates="{{hap_dest}}"
    20   become: yes
       
    21   become_user: "{{hap_user}}"
       
    22   unarchive:
       
    23     src: "{{hap_src}}"
       
    24     dest: "{{hap_dir}}"
       
    25     remote_src: "yes"
       
    26     creates: "{{hap_dest}}"
       
    27     owner: "{{hap_user}}"
       
    28     group: "{{hap_user}}"
    10 
    29 
    11 - name: install npm packages
    30 - name: install npm packages
       
    31   become: yes
       
    32   become_user: "{{hap_user}}"
    12   npm: name="{{item}}" path="{{hap_dest}}"
    33   npm: name="{{item}}" path="{{hap_dest}}"
    13   with_items: "{{hap_npm_packages}}"
    34   with_items: "{{hap_npm_packages}}"
    14 
    35 
    15 - name: clean up accessory examples
    36 - name: clean up accessory examples
       
    37   become: yes
    16   file: path="{{hap_dest}}/accessories" state="absent"
    38   file: path="{{hap_dest}}/accessories" state="absent"
    17 
    39 
    18 - name: create accessories dir
    40 - name: create accessories dir
    19   file: path="{{hap_dest}}/accessories" state="directory"
    41   become: yes
       
    42   file:
       
    43     path: "{{hap_dest}}/accessories"
       
    44     state: "directory"
       
    45     owner: "{{hap_user}}"
       
    46     group: "{{hap_user}}"
    20 
    47 
    21 - name: create python dir
    48 - name: create python dir
    22   file: path="{{hap_dest}}/python" state="directory"
    49   become: yes
       
    50   file:
       
    51     path: "{{hap_dest}}/python"
       
    52     state: "directory"
       
    53     owner: "{{hap_user}}"
       
    54     group: "{{hap_user}}"
    23 
    55 
    24 - name: install doord.py
    56 - name: install doord.py
    25   copy: src="../../../src/doord.py" dest="{{hap_dest}}/python/doord.py"
    57   become: yes
       
    58   copy:
       
    59     src: "../../../src/doord.py"
       
    60     dest: "{{hap_dest}}/python/doord.py"
       
    61     owner: "{{hap_user}}"
       
    62     group: "{{hap_user}}"
       
    63     mode: "0755"
    26   notify: restart hap-nodejs service
    64   notify: restart hap-nodejs service
    27 
    65 
    28 - name: install door accessory
    66 - name: install door accessory
    29   copy: src="../../../src/Door_accessory.js" dest="{{hap_dest}}/accessories/Door_accessory.js"
    67   become: yes
       
    68   copy:
       
    69     src: "../../../src/Door_accessory.js"
       
    70     dest: "{{hap_dest}}/accessories/Door_accessory.js"
       
    71     owner: "{{hap_user}}"
       
    72     group: "{{hap_user}}"
    30   notify: restart hap-nodejs service
    73   notify: restart hap-nodejs service
    31 
    74 
    32 - name: build HAP-NodeJS
    75 - name: build HAP-NodeJS
       
    76   become: yes
       
    77   become_user: "{{hap_user}}"
    33   npm: path="{{hap_dest}}"
    78   npm: path="{{hap_dest}}"
    34 
    79 
    35 - name: configure systemd service
    80 - name: configure systemd service
    36   become: yes
    81   become: yes
    37   template: src="hap-nodejs.service.j2" dest="/lib/systemd/system/hap-nodejs.service"
    82   template: src="hap-nodejs.service.j2" dest="/lib/systemd/system/hap-nodejs.service"