Files
setup-gitea-runner/tasks/install.yml
2026-03-04 19:32:57 +01:00

54 lines
1.6 KiB
YAML

# https://docs.ansible.com/ansible/latest/collections/ansible/builtin/get_url_module.html
# https://docs.ansible.com/ansible/latest/collections/ansible/builtin/user_module.html
# https://docs.ansible.com/ansible/latest/collections/ansible/builtin/copy_module.html
# https://docs.ansible.com/ansible/latest/collections/ansible/builtin/template_module.html
# https://docs.ansible.com/ansible/latest/collections/ansible/builtin/service_module.html
---
- name: create runner user
tags: [install]
ansible.builtin.user:
name: "{{ RUNNER_USER }}"
create_home: yes
groups: "{{ RUNNER_USER_GROUPS }}"
append: true
home: "{{ RUNNER_DIR }}"
- name: download runner
tags: [install]
delegate_to: localhost
run_once: true
ansible.builtin.get_url:
url: "{{ RUNNER_DOWNLOAD_URL }}"
dest: "/{{ RUNNER_DOWNLOAD_DIR }}/{{ RUNNER_NAME }}"
mode: '0440'
- name: copy runner binary
tags: [install]
copy:
src: "{{ RUNNER_DOWNLOAD_DIR }}/{{ RUNNER_NAME }}"
dest: "{{ RUNNER_DIR }}/{{ RUNNER_NAME }}"
owner: "{{ RUNNER_USER }}"
group: "{{ RUNNER_GROUP | default(RUNNER_USER) }}"
mode: '0770'
- name: create runner config
tags: [install]
ansible.builtin.template:
src: config.yml.j2
dest: "{{ RUNNER_DIR }}/config.yml"
owner: "{{ RUNNER_USER }}"
group: "{{ RUNNER_GROUP | default(RUNNER_USER) }}"
mode: '0660'
- name: create runner service file
tags: [install]
notify: reload daemons
ansible.builtin.template:
src: runner.service.j2
dest: "/etc/systemd/system/{{ RUNNER_SERVICE_NAME }}"
owner: root
group: root
mode: '0600'
- name: flush handlers
meta: flush_handlers