---
- name: Dependencies installed
  community.general.pkgng:
    name: "npm git-tiny"
    state: latest

- name: Source folder exists
  file:
    path: /usr/local/src
    mode: 0755
    state: directory

- name: Multi-scrobbler source fetched
  shell: git clone https://github.com/FoxxMD/multi-scrobbler.git /usr/local/src/multi-scrobbler

- name: Multi-scrobbler installed
  shell:
    cmd: npm install
    chdir: /usr/local/src/multi-scrobbler

- name: Multi-scrobbler conf file installed
  template:
    src: config.json.j2
    dest: /usr/local/etc/multi-scrobbler/config.json
    owner: root
    mode: 0644

- name: Multi-scrobbler immortal file installed
  template:
    src: immortal.yml.j2
    dest: /usr/local/etc/immortal/multi-scrobbler.yml
    owner: root
    mode: 0644
  notify: Immortal restarted
