From 4bddee9ee93079fcd4848f8357cf0f9f524d454b Mon Sep 17 00:00:00 2001 From: Gitea Date: Sat, 7 Aug 2021 14:08:17 -0400 Subject: [PATCH] playbook adjustments --- deploy.yml | 55 ++++++++++++++++++++++++++++++------------------------ 1 file changed, 31 insertions(+), 24 deletions(-) diff --git a/deploy.yml b/deploy.yml index 4195596..9c34a00 100644 --- a/deploy.yml +++ b/deploy.yml @@ -9,38 +9,45 @@ return_content: true register: simpbot_latest - - name: "installing simpbot {{ simpbot_latest.json.tag_name }}" - loop: "{{ simpbot_latest.json.[0].assets }}" - when: "'amd64.tar.gz' in item.name" - unarchive: - remote_src: yes - src: "{{ item.browser_download_url }}" - dest: "/tmp/simpbot" - keep_newer: yes - extra_opts: - - --strip=1 - - --no-anchored - - simpbot + - name: "downloading and installing simpbot {{ simpbot_latest.json[0].tag_name }}" + block: + - name: create temp directory + tempfile: + state: directory + suffix: dwn + register: tempfolder_1 - - name: installing simpbot binary - copy: - src: /tmp/simpbot/simpbot - dest: /usr/local/bin/ - register: new_binary + - name: download simpbot + loop: "{{ simpbot_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 unit file - copy: - src: /tmp/simpbot/init/simpbot.service - dest: /etc/systemd/system/simpbot.service - register: new_unit + - name: installing simpbot binary + copy: + remote_src: yes + src: "{{ tempfolder_1.path }}/simpbot" + dest: /usr/local/bin/ + mode: '0755' + register: new_binary + + - name: installing unit file + copy: + remote_src: yes + src: "{{ tempfolder_1.path }}/init/simpbot.service" + dest: /etc/systemd/system/simpbot.service + register: new_unit - name: reload systemd with new unit systemd: daemon_reload: yes - when: new_unit || new_binary + when: new_unit.changed or new_binary.changed - name: start service systemd: name: simpbot state: restarted - when: new_binary + when: new_binary.changed