GRM-14: feat: add systemd template units and multi-instance Ansible support

- Add instance-scoped base data/config directories in defaults
- Create gitea-runner@.service.j2 template supporting Docker and binary modes
- Refactor service.yml to install systemd template unit instances
- Remove direct container lifecycle from docker_mode.yml (delegate to systemd)
- Add deregister.yml for runner deregistration on disable/remove
- Create lifecycle playbooks: start, stop, enable, disable, status, remove
- Update handlers, integration_test, docker_update, binary_update for template units
This commit is contained in:
Emil Simeonov
2026-06-18 22:59:04 +02:00
parent 047ee05fa1
commit e5964ca5a9
15 changed files with 285 additions and 52 deletions
@@ -44,26 +44,5 @@
changed_when: "'already exists' not in register_output.stdout | default('')"
timeout: 60
- name: Check if gitea_runner container exists
ansible.builtin.command: docker inspect -f '{{ '{{' }} .State.Running {{ '}}' }}' gitea-runner-{{ runner_name }}
register: container_check
changed_when: false
failed_when: container_check.rc != 0 and 'no such object' not in container_check.stderr
- name: Run gitea_runner daemon container
ansible.builtin.command: >
docker run -d
--name gitea-runner-{{ runner_name }}
--restart unless-stopped
--entrypoint /usr/local/bin/gitea-runner
-v /var/run/docker.sock:/var/run/docker.sock
-v {{ gitea_runner_data_dir }}:/data
-w /data
{{ gitea_runner_docker_image }}:{{ gitea_runner_version | regex_replace('^v', '') }}
daemon
--config /data/config.yaml
when:
- container_check.rc != 0
- not skip_runner_registration
register: docker_run
changed_when: docker_run.rc == 0
- name: Include service setup
ansible.builtin.include_tasks: service.yml