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>
This commit is contained in:
co-authored by
Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
parent
fcd26dd110
commit
b7a04f37de
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user