feat(gitea_runner): add the gitea_runner role
Copied from the maintainer's local role and reworked for the Collection: the binary swap and rollback of an update go through the internal _binary_update role, input checks move to tasks/validate.yml, the removal ends the role, commands take argv, and the molecule tooling needs an explicit collections requirements file. Adds a molecule scenario with stub Docker, runner and release files. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01MmzvM9skAvYcph2c9EiPcm
This commit is contained in:
1 parent
3ed614e00e
commit
e296eea609
28 files changed
+1988
-3
No files matched your search
@@ -0,0 +1,75 @@
|
||||
---
|
||||
# Run with -e gitea_runner_remove=true (and gitea_runner_remove_data=true to delete the
|
||||
# registration and config too). The role ends after these tasks.
|
||||
- name: Stop Gitea runner service
|
||||
become: true
|
||||
ansible.builtin.systemd:
|
||||
name: gitea-runner
|
||||
state: stopped
|
||||
enabled: false
|
||||
register: gitea_runner_stop
|
||||
# The unit may already be gone (systemd: "Could not find the requested service <unit>").
|
||||
# Any other stop failure must halt here, before the unit file and data are deleted.
|
||||
failed_when:
|
||||
- gitea_runner_stop.failed | default(false)
|
||||
- "'Could not find the requested service' not in (gitea_runner_stop.msg | default(''))"
|
||||
tags: [gitea_runner, remove]
|
||||
|
||||
- name: Stop the Docker prune timer
|
||||
become: true
|
||||
ansible.builtin.systemd:
|
||||
name: gitea-runner-docker-prune.timer
|
||||
state: stopped
|
||||
enabled: false
|
||||
register: gitea_runner_prune_stop
|
||||
failed_when:
|
||||
- gitea_runner_prune_stop.failed | default(false)
|
||||
- "'Could not find the requested service' not in (gitea_runner_prune_stop.msg | default(''))"
|
||||
tags: [gitea_runner, remove]
|
||||
|
||||
- name: Remove the Docker prune units
|
||||
become: true
|
||||
ansible.builtin.file:
|
||||
path: "/etc/systemd/system/{{ gitea_runner_prune_unit }}"
|
||||
state: absent
|
||||
loop:
|
||||
- gitea-runner-docker-prune.timer
|
||||
- gitea-runner-docker-prune.service
|
||||
loop_control:
|
||||
loop_var: gitea_runner_prune_unit
|
||||
tags: [gitea_runner, remove]
|
||||
|
||||
- name: Remove the Docker prune gate script
|
||||
become: true
|
||||
ansible.builtin.file:
|
||||
path: /usr/local/sbin/gitea-runner-docker-prune-gate
|
||||
state: absent
|
||||
tags: [gitea_runner, remove]
|
||||
|
||||
- name: Remove systemd unit
|
||||
become: true
|
||||
ansible.builtin.file:
|
||||
path: "{{ gitea_runner_service_unit }}"
|
||||
state: absent
|
||||
tags: [gitea_runner, remove]
|
||||
|
||||
- name: Reload systemd
|
||||
become: true
|
||||
ansible.builtin.systemd:
|
||||
daemon_reload: true
|
||||
tags: [gitea_runner, remove]
|
||||
|
||||
- name: Remove runner binary
|
||||
become: true
|
||||
ansible.builtin.file:
|
||||
path: "{{ gitea_runner_install_dir }}/gitea-runner"
|
||||
state: absent
|
||||
tags: [gitea_runner, remove]
|
||||
|
||||
- name: Remove runner work directory
|
||||
become: true
|
||||
ansible.builtin.file:
|
||||
path: "{{ gitea_runner_work_dir }}"
|
||||
state: absent
|
||||
when: gitea_runner_remove_data | default(false) | bool
|
||||
tags: [gitea_runner, remove]
|
||||
Reference in new issue
Block a user