roles/homebridge/tasks/main.yaml
changeset 0 df042396074e
equal deleted inserted replaced
-1:000000000000 0:df042396074e
       
     1 ---
       
     2 
       
     3 - name: create homebridge user
       
     4   become: yes
       
     5   user:
       
     6     name: "{{homebridge_user}}"
       
     7     comment: "Homebridge"
       
     8     shell: "/bin/false"
       
     9     home: "{{homebridge_dir}}"
       
    10     groups: "video,spi,i2c,gpio"
       
    11     move_home: yes
       
    12   notify: restart homebridge service
       
    13 
       
    14 - name: create homebridge directory
       
    15   become: yes
       
    16   file:
       
    17     path: "{{homebridge_dir}}"
       
    18     state: "directory"
       
    19     owner: "{{homebridge_user}}"
       
    20     group: "{{homebridge_user}}"
       
    21     mode: "0755"
       
    22 
       
    23 - name: install homebridge apt deps
       
    24   become: yes
       
    25   apt: name="{{homebridge_apt_packages}}"
       
    26 
       
    27 - name: install homebridge
       
    28   become: yes
       
    29   become_user: "{{homebridge_user}}"
       
    30   npm: name="homebridge" global="yes"
       
    31   notify: restart homebridge service
       
    32 
       
    33 - name: install platform accessories
       
    34   become: yes
       
    35   become_user: "{{homebridge_user}}"
       
    36   npm: name="{{item}}" global="yes"
       
    37   notify: restart homebridge service
       
    38   with_items: "{{homebridge_npm_packages}}"
       
    39 
       
    40 - name: configure homebridge
       
    41   become: yes
       
    42   template:
       
    43     src: "config.json.j2"
       
    44     dest: "{{homebridge_dir}}/config.json"
       
    45   notify: restart homebridge service
       
    46 
       
    47 - name: configure systemd service
       
    48   become: yes
       
    49   template:
       
    50     src: "homebridge.service.j2"
       
    51     dest: "/lib/systemd/system/homebridge.service"
       
    52   notify: restart homebridge service
       
    53 
       
    54 - name: ensure homebridge is started
       
    55   become: yes
       
    56   systemd: name="homebridge.service" enabled="yes" state="started"