nunbot/deploy.yml

53 lines
1.4 KiB
YAML
Raw Permalink Normal View History

---
- hosts: localhost
tasks:
- name: check nunbot version
uri:
url: https://git.saintnet.tech/api/v1/repos/stryan/nunbot/releases?limit=1
return_content: true
register: nunbot_latest
- name: "downloading and installing nunbot {{ nunbot_latest.json[0].tag_name }}"
block:
- name: create temp directory
tempfile:
state: directory
suffix: dwn
register: tempfolder_1
- name: download nunbot
loop: "{{ nunbot_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 nunbot binary
copy:
remote_src: yes
src: "{{ tempfolder_1.path }}/nunbot"
dest: /usr/local/bin/
mode: '0755'
register: new_binary
- name: installing unit file
copy:
remote_src: yes
src: "{{ tempfolder_1.path }}/init/nunbot.service"
dest: /etc/systemd/system/nunbot.service
register: new_unit
- name: reload systemd with new unit
systemd:
daemon_reload: yes
when: new_unit.changed or new_binary.changed
- name: start service
systemd:
name: nunbot
state: restarted
when: new_binary.changed