Files
setup-gitea-runner/tasks/config.yml
2026-03-04 19:06:18 +01:00

30 lines
966 B
YAML

# https://docs.ansible.com/ansible/latest/collections/ansible/builtin/copy_module.html
# https://docs.ansible.com/ansible/latest/collections/ansible/builtin/service_module.html
---
- name: delete .runner file for redeploy
ansible.builtin.file:
state: absent
path: "{{ RUNNER_DIR }}/.runner"
when: RUNNER_REDEPLOY
- name: register runner
notify: restart runner
ansible.builtin.command:
cmd: "{{ RUNNER_DIR }}/{{ RUNNER_NAME }} register --no-interactive --instance {{ RUNNER_INSTANCE }} --token {{ RUNNER_TOKEN }}"
chdir: "{{ RUNNER_DIR }}"
creates: "{{ RUNNER_DIR }}/.runner"
when:
- RUNNER_TOKEN != None
- name: ensure correct access rights for .runner file
ansible.builtin.file:
path: "{{ RUNNER_DIR }}/.runner"
owner: "{{ RUNNER_USER }}"
group: "{{ RUNNER_GROUP }}"
mode: '0660'
- name: enable runner
notify: restart runner
ansible.builtin.service:
name: "{{ RUNNER_SERVICE_NAME }}"
enabled: yes