This is the multi-page printable view of this section. Click here to print.

Return to the regular view of this page.

Forgejo runner

Install and register a Forgejo Actions runner

Installs the repository-pinned Linux x86-64 Forgejo runner, creates its service account, registers it with Forgejo, and manages its systemd service. The binary and configuration are root-owned. The home and work directories belong to the runner account. Registration and the daemon use the same explicit configuration and registration file, so repeated deployments reuse the existing runner.

Supply forgejo_runner_instance and forgejo_runner_token for initial registration. forgejo_runner_name defaults to the inventory hostname. Inject the token from Vault; the role passes it through standard input with logging suppressed. The registration file is mode 0600. Changing labels or capacity updates the daemon configuration; changing a registered runner’s instance or identity requires deliberate re-registration.

Set forgejo_runner_install_packages: false when the calling deployment supplies all runner packages, including on RPM-OSTree hosts. Node.js is required for JavaScript actions such as checkout. The acl package must be available for Ansible to execute registration as the unprivileged runner account; both roles include it in their package defaults. Complete any required reboot before starting this role. Container runtime configuration remains the caller’s responsibility. The default installation and service paths are writable on OSTree hosts.

Host executor labels run jobs as the runner account without job isolation. Restrict registration to trusted repositories and keep deployment credentials out of the runner environment. The role does not grant sudo access. The Actions cache service is disabled by default; enable it only after configuring its network reachability. Configuration, binary, and service changes trigger a handler to reload systemd and restart the runner.

1 - Defaults

Defaults for forgejo_runner
---
forgejo_runner_user: forgejo-runner
forgejo_runner_user_uid: 5721
forgejo_runner_dir: /opt/forgejo-runner
forgejo_runner_home_dir: "{{ forgejo_runner_dir }}/home"
forgejo_runner_work_dir: "{{ forgejo_runner_dir }}/work"
forgejo_runner_bin_local_path: "{{ role_path }}/files/forgejo-runner"
forgejo_runner_bin_path: "{{ forgejo_runner_dir }}/forgejo-runner"
forgejo_runner_service_path: /etc/systemd/system/forgejo-runner.service
forgejo_runner_config_path: "{{ forgejo_runner_dir }}/config.yaml"
forgejo_runner_registration_path: "{{ forgejo_runner_work_dir }}/.runner"
forgejo_runner_install_packages: true
forgejo_runner_packages:
  - acl
  - git
  - nodejs
  - podman
forgejo_runner_instance: "{{ undefined() }}"
forgejo_runner_token: "{{ undefined() }}"
forgejo_runner_name: "{{ inventory_hostname }}"
forgejo_runner_labels:
  - "self-hosted:host"
forgejo_runner_capacity: 1
forgejo_runner_timeout: 3h
forgejo_runner_shutdown_timeout: 30s
forgejo_runner_service_stop_timeout: 60s
forgejo_runner_registration_timeout: 120
forgejo_runner_cache_enabled: false