homebridge/tasks/main.yaml
author Luke Hoersten <luke@hoersten.org>
Fri, 03 Jul 2020 09:38:16 -0500
changeset 110 83833f68dc36
parent 34 ecbdaed7f151
child 144 267d58c0e186
permissions -rw-r--r--
Added jellyfin role. Forkbombs my computer though.

---

- name: create homebridge user
  become: yes
  user:
    name: "{{homebridge_user}}"
    comment: "Homebridge"
    shell: "/bin/false"
    home: "{{homebridge_dir}}"
    groups: "{{homebridge_groups}}"
    move_home: yes
  notify: restart homebridge service

- name: create homebridge directory
  become: yes
  file:
    path: "{{homebridge_dir}}"
    state: "directory"
    owner: "{{homebridge_user}}"
    group: "{{homebridge_user}}"
    mode: "0755"

- name: install homebridge apt deps
  become: yes
  apt: name="{{homebridge_apt_packages}}"

- name: install homebridge
  become: yes
  npm: name="homebridge" global="yes"
  notify: restart homebridge service

- name: install platform accessories
  become: yes
  npm: name="{{item}}" global="yes"
  with_items: "{{homebridge_npm_packages}}"
  notify: restart homebridge service

- name: configure homebridge
  become: yes
  template:
    src: "{{homebridge_config_template}}"
    dest: "{{homebridge_dir}}/config.json"
  notify: restart homebridge service

- name: configure systemd service
  become: yes
  template:
    src: "homebridge.service.j2"
    dest: "/lib/systemd/system/homebridge.service"
  notify: restart homebridge service

- name: ensure homebridge is started
  become: yes
  systemd: name="homebridge.service" enabled="yes" state="started"