--- - name: Find latest available version ansible.builtin.uri: url: https://codeberg.org/forgejo/forgejo/releases/latest register: latest_http_content - name: Set latest available version ansible.builtin.set_fact: forgejo_latest_version: "{{ latest_http_content.url | split('/') | last }}" - name: Define forgejo architecture ansible.builtin.set_fact: forgejo_architecture: "{{ (ansible_facts['architecture'] == 'x86_64') | ternary('amd64', 'arm-6') }}" - name: Find if latest available version is installed become: true ansible.builtin.stat: path: "{{ forgejo_run_dir }}/forgejo-{{ forgejo_latest_version | replace('v', '') }}-linux-{{ forgejo_architecture }}" register: latest_installed_binary - name: Get latest forgejo binary become: true ansible.builtin.get_url: url: "https://codeberg.org/forgejo/forgejo/releases/download/{{ forgejo_latest_version }}/forgejo-{{ forgejo_latest_version | replace('v', '') }}-linux-{{ forgejo_architecture }}" dest: "{{ forgejo_run_dir }}/forgejo-{{ forgejo_latest_version | replace('v', '') }}-linux-{{ forgejo_architecture }}" owner: git group: git mode: 0644 when: not latest_installed_binary.stat.exists notify: - Receive forgejo pgp key - Download forgejo asc file - Verify forgejo binary with gpg - 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 | replace('v', '') }}-linux-{{ forgejo_architecture }}" dest: /usr/local/bin/forgejo remote_src: true owner: root group: root mode: 0755 notify: Restart forgejo service