---

- name: ensure goploader user is present
  user:
    name: "goploader"
    home: "/srv/goploader"
    shell: "/bin/bash"
    state: present

- name: Download Goploader
  get_url:
    url: https://github.com/Depado/goploader/releases/download/v1.0/server_amd64.tar.gz
    dest: /srv/goploader/server.tgz
  become: true
  become_user: goploader

- name: Unarchive goploader
  unarchive:
    src: /srv/goploader/server.tgz
    remote_src: yes
    dest: /srv/goploader
    owner: goploader
    group: goploader


- name: Template systemd service
  template:
    src: goploader.service
    dest: /etc/systemd/system/goploader.service
    owner: root
    group: root
    mode: 0644
  notify:
    - Restart goploader



