From 776fd31d8b32239cc785d44d9a67d7d23f4286c1 Mon Sep 17 00:00:00 2001 From: Tunui Franken Date: Fri, 21 Mar 2025 10:58:09 +0100 Subject: [PATCH] Fix handler of forgejo restart running when service doesn't exist yet --- roles/forgejo/handlers/main.yml | 11 ----------- roles/forgejo/tasks/binary.yml | 15 +++++++++++++-- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/roles/forgejo/handlers/main.yml b/roles/forgejo/handlers/main.yml index f1a6177..23e5a93 100644 --- a/roles/forgejo/handlers/main.yml +++ b/roles/forgejo/handlers/main.yml @@ -22,17 +22,6 @@ changed_when: false failed_when: '"Good signature from" not in result.stderr' -- name: Copy binary to global location - become: true - ansible.builtin.copy: - src: "{{ forgejo_run_dir }}/forgejo-{{ forgejo_latest_version }}-linux-{{ forgejo_architecture }}" - dest: /usr/local/bin/forgejo - remote_src: true - owner: root - group: root - mode: 0755 - notify: Restart forgejo service - - name: Start forgejo service become: true ansible.builtin.systemd: diff --git a/roles/forgejo/tasks/binary.yml b/roles/forgejo/tasks/binary.yml index 24ad28c..84720d8 100644 --- a/roles/forgejo/tasks/binary.yml +++ b/roles/forgejo/tasks/binary.yml @@ -32,7 +32,18 @@ - Receive forgejo pgp key - Download forgejo asc file - Verify forgejo binary with gpg - - Copy binary to global location -- name: Make sure downloaded binary has been verified and copied to global location +- name: Make sure downloaded binary has been verified ansible.builtin.meta: flush_handlers + +- name: Copy binary to global location + become: true + ansible.builtin.copy: + src: "{{ forgejo_run_dir }}/forgejo-{{ forgejo_latest_version }}-linux-{{ forgejo_architecture }}" + dest: /usr/local/bin/forgejo + remote_src: true + owner: root + group: root + mode: 0755 + when: forgejo_installed_version.stdout is version(forgejo_latest_version, '<') + notify: Restart forgejo service