Files
grm/ansible/roles/gitea-runner/tasks/download_gitea_runner.yml
T
Emil SimeonovandDevin <158243242+devin-ai-integration[bot]@users.noreply.github.com> b7a04f37de
CI / quality (pull_request) Successful in 1m6s
CI / molecule-tests (0) (pull_request) Failing after 4m9s
CI / molecule-tests (2) (pull_request) Failing after 4m11s
CI / molecule-tests (1) (pull_request) Failing after 4m16s
fix: make user_setup and download tasks idempotent
The "Enable lingering" task always reported changed=true, and the
"Download gitea_runner binary" task used force=true which always
re-downloads. Both caused molecule idempotence tests to fail.

- Check /var/lib/systemd/linger/<user> before enabling lingering
- Set force=false on get_url so binary is only downloaded if missing

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-06-21 00:13:19 +02:00

49 lines
1.5 KiB
YAML

---
- name: Get latest gitea_runner release info
ansible.builtin.uri:
url: https://gitea.com/api/v1/repos/gitea/runner/releases/latest
return_content: true
body_format: json
headers:
Accept: application/json
register: gitea_runner_release
when: gitea_runner_version | default('latest') == 'latest'
changed_when: false
retries: 3
delay: 5
until: gitea_runner_release is not failed
- name: Set gitea_runner version from latest release
ansible.builtin.set_fact:
gitea_runner_version: "{{ gitea_runner_release.json.tag_name }}"
when: gitea_runner_version | default('latest') == 'latest'
- name: Set gitea_runner download version (strip v prefix)
ansible.builtin.set_fact:
gitea_runner_download_version: "{{ gitea_runner_version | regex_replace('^v', '') }}"
- name: Set gitea_runner download URL
ansible.builtin.set_fact:
gitea_runner_url: >-
{{ 'https://gitea.com/gitea/runner/releases/download/v' ~ gitea_runner_download_version
~ '/gitea-runner-' ~ gitea_runner_download_version ~ '-linux-'
~ (ansible_facts['architecture'] | regex_replace('x86_64', 'amd64')) }}
- name: Ensure /usr/local/bin directory exists
ansible.builtin.file:
path: /usr/local/bin
state: directory
mode: "0755"
- name: Download gitea_runner binary
ansible.builtin.get_url:
url: "{{ gitea_runner_url }}"
dest: "{{ gitea_runner_binary_path }}"
mode: "0755"
force: false
register: gitea_runner_download
notify: Restart gitea-runner
retries: 3
delay: 5
until: gitea_runner_download is not failed