fix: make user_setup and download tasks idempotent
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

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>
This commit is contained in:
Emil Simeonov
2026-06-21 00:13:19 +02:00
co-authored by Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
parent fcd26dd110
commit b7a04f37de
2 changed files with 7 additions and 2 deletions
@@ -40,7 +40,7 @@
url: "{{ gitea_runner_url }}"
dest: "{{ gitea_runner_binary_path }}"
mode: "0755"
force: true
force: false
register: gitea_runner_download
notify: Restart gitea-runner
retries: 3
@@ -12,9 +12,14 @@
ansible.builtin.set_fact:
gitea_runner_uid: "{{ runner_user.uid }}"
- name: Check if lingering is already enabled
ansible.builtin.stat:
path: "/var/lib/systemd/linger/{{ gitea_runner_service_user }}"
register: linger_stat
- name: Enable lingering for runner user
ansible.builtin.command: loginctl enable-linger {{ gitea_runner_service_user }}
changed_when: true
changed_when: not linger_stat.stat.exists
- name: Ensure subuid entry for runner user
ansible.builtin.lineinfile: