2021-08-07 15:00:42 -04:00
|
|
|
---
|
|
|
|
|
|
|
|
- hosts: localhost
|
|
|
|
tasks:
|
|
|
|
|
|
|
|
- name: check guildgate version
|
|
|
|
uri:
|
|
|
|
url: https://git.saintnet.tech/api/v1/repos/stryan/guildgate/releases?limit=1
|
|
|
|
return_content: true
|
|
|
|
register: guildgate_latest
|
|
|
|
|
|
|
|
- name: "downloading and installing guildgate {{ guildgate_latest.json[0].tag_name }}"
|
|
|
|
block:
|
|
|
|
- name: create temp directory
|
|
|
|
tempfile:
|
|
|
|
state: directory
|
|
|
|
suffix: dwn
|
|
|
|
register: tempfolder_1
|
|
|
|
|
|
|
|
- name: download guildgate
|
|
|
|
loop: "{{ guildgate_latest.json[0].assets }}"
|
|
|
|
when: "'amd64.tar.gz' in item.name"
|
|
|
|
unarchive:
|
|
|
|
remote_src: yes
|
|
|
|
src: "{{ item.browser_download_url }}"
|
|
|
|
dest: "{{ tempfolder_1.path }}"
|
|
|
|
keep_newer: yes
|
|
|
|
|
|
|
|
- name: installing guildgate binary
|
|
|
|
copy:
|
|
|
|
remote_src: yes
|
2021-08-07 15:22:10 -04:00
|
|
|
src: "{{ tempfolder_1.path }}/build/usr/local/bin/guildgate"
|
2021-08-07 15:00:42 -04:00
|
|
|
dest: /usr/local/bin/
|
|
|
|
mode: '0755'
|
|
|
|
register: new_binary
|
|
|
|
|
|
|
|
- name: installing unit file
|
|
|
|
copy:
|
|
|
|
remote_src: yes
|
|
|
|
src: "{{ tempfolder_1.path }}/init/guildgate.service"
|
|
|
|
dest: /etc/systemd/system/guildgate.service
|
|
|
|
register: new_unit
|
|
|
|
|
2021-08-07 15:15:05 -04:00
|
|
|
- name: installing default templates
|
|
|
|
copy:
|
|
|
|
remote_src: yes
|
2021-08-07 15:22:10 -04:00
|
|
|
src: "{{ tempfolder_1.path}}/build/usr/local/share/guildgate/"
|
2021-08-07 15:15:05 -04:00
|
|
|
dest: /usr/local/share
|
|
|
|
|
2021-08-07 15:00:42 -04:00
|
|
|
- name: reload systemd with new unit
|
|
|
|
systemd:
|
|
|
|
daemon_reload: yes
|
|
|
|
when: new_unit.changed or new_binary.changed
|
|
|
|
|
|
|
|
- name: start service
|
|
|
|
systemd:
|
|
|
|
name: guildgate
|
|
|
|
state: restarted
|
|
|
|
when: new_binary.changed
|