Files
Kamino/roles/gitea_runner/tasks/remove.yml
T
Defame1297 e91c074373 fix(gitea_runner): address review of the prune count and threshold
Give each new input its own assert message so every refused-input case
matches only its own input, and cover a negative count and a bad disk
check schedule. Fire the pressure prune only above the threshold, as
the inputs describe it. Name the disk check script apart from the
pressure service, prefix the new registers as internal, and keep the
new comments short.

Refs #319

Assisted-by: Claude Code
2026-11-23 18:20:32 +00:00

89 lines
2.7 KiB
YAML

---
# 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 timers
become: true
ansible.builtin.systemd:
name: "{{ gitea_runner_prune_timer_name }}"
state: stopped
enabled: false
loop:
- gitea-runner-docker-prune.timer
- gitea-runner-docker-prune-pressure.timer
loop_control:
loop_var: gitea_runner_prune_timer_name
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
- gitea-runner-docker-prune-pressure.timer
- gitea-runner-docker-prune-pressure.service
loop_control:
loop_var: gitea_runner_prune_unit
tags: [gitea_runner, remove]
- name: Remove the Docker prune scripts
become: true
ansible.builtin.file:
path: "/usr/local/sbin/{{ gitea_runner_prune_script }}"
state: absent
loop:
- gitea-runner-docker-prune-gate
- gitea-runner-docker-prune-keep
- gitea-runner-docker-prune-disk-check
loop_control:
loop_var: gitea_runner_prune_script
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]