ansible/roles/forgejo_runners
Julien Riou 989042f28a
Some checks failed
/ ansible-docsmith (push) Failing after 24s
Initial commit
Signed-off-by: Julien Riou <julien@riou.xyz>
2026-02-16 09:19:09 +01:00
..
defaults Initial commit 2026-02-16 09:19:09 +01:00
handlers Initial commit 2026-02-16 09:19:09 +01:00
meta Initial commit 2026-02-16 09:19:09 +01:00
tasks Initial commit 2026-02-16 09:19:09 +01:00
templates Initial commit 2026-02-16 09:19:09 +01:00
README.md Initial commit 2026-02-16 09:19:09 +01:00
TODO.txt Initial commit 2026-02-16 09:19:09 +01:00

Ansible Role Forgejo Runners

Ansible role to manage Forgejo runners.

Configuration

See Variable precedence to find where you should put your own variables.

Then define at least forgejo_db_password with a strong and secure password, encrypted using ansible-vault.

Table of Content

Role variables

The following variables can be configured for this role:

Variable Type Required Default Description (abstract)
forgejo_server bool No true Enable the server mode
forgejo_version int No 14 Version of the Forgejo binaries
forgejo_home_dir path No "/var/lib/forgejo" Path to the home directory
forgejo_config_dir path No "/etc/forgejo" Path to the configuration directory
forgejo_web_port int No 3000 Port to listen for the web UI
forgejo_ssh_port int No 222 Port to listen for SSH
forgejo_db_username str No "forgejo" Name of the user in the database
forgejo_db_password str Yes N/A Password of the user in the database
forgejo_db_database str No "forgejo" Name of the database
forgejo_mailer dict No N/A Configure the mailer to send e-mail notifications

Define a enabled key with a boolean to enable the mailer

Define a from key with the source e-mail address

See Email setup
forgejo_service dict No N/A Configure service settings

See Service
forgejo_manage_iptables bool No false Configure iptables rules
forgejo_allowed_sources list No N/A List of IP ranges to allow when forgejo_manage_iptables is enabled
forgejo_runners_version str No "9.1.1" Version of the runners
forgejo_runners_config_dir path No "/etc/forgejo-runners" Path to the configuration directory of the runners
forgejo_runners_instance str No N/A URL of the Forgejo instance to register the runners
forgejo_runners dict No N/A List of runners to configure

The key is the name of the repository on the instance

The value is a dict with a token key and optionally a dict of labels

forgejo_server

⇑ Back to ToC ⇑

Enable the server mode

  • Type: bool
  • Required: No
  • Default: true

forgejo_version

⇑ Back to ToC ⇑

Version of the Forgejo binaries

  • Type: int
  • Required: No
  • Default: 14

forgejo_home_dir

⇑ Back to ToC ⇑

Path to the home directory

  • Type: path
  • Required: No
  • Default: "/var/lib/forgejo"

forgejo_config_dir

⇑ Back to ToC ⇑

Path to the configuration directory

  • Type: path
  • Required: No
  • Default: "/etc/forgejo"

forgejo_web_port

⇑ Back to ToC ⇑

Port to listen for the web UI

  • Type: int
  • Required: No
  • Default: 3000

forgejo_ssh_port

⇑ Back to ToC ⇑

Port to listen for SSH

  • Type: int
  • Required: No
  • Default: 222

forgejo_db_username

⇑ Back to ToC ⇑

Name of the user in the database

  • Type: str
  • Required: No
  • Default: "forgejo"

forgejo_db_password

⇑ Back to ToC ⇑

Password of the user in the database

  • Type: str
  • Required: Yes

forgejo_db_database

⇑ Back to ToC ⇑

Name of the database

  • Type: str
  • Required: No
  • Default: "forgejo"

forgejo_mailer

⇑ Back to ToC ⇑

Configure the mailer to send e-mail notifications

Define a enabled key with a boolean to enable the mailer

Define a from key with the source e-mail address

See Email setup

  • Type: dict
  • Required: No

forgejo_service

⇑ Back to ToC ⇑

Configure service settings

See Service

  • Type: dict
  • Required: No

forgejo_manage_iptables

⇑ Back to ToC ⇑

Configure iptables rules

  • Type: bool
  • Required: No
  • Default: false

forgejo_allowed_sources

⇑ Back to ToC ⇑

List of IP ranges to allow when forgejo_manage_iptables is enabled

  • Type: list
  • Required: No

forgejo_runners_version

⇑ Back to ToC ⇑

Version of the runners

  • Type: str
  • Required: No
  • Default: "9.1.1"

forgejo_runners_config_dir

⇑ Back to ToC ⇑

Path to the configuration directory of the runners

  • Type: path
  • Required: No
  • Default: "/etc/forgejo-runners"

forgejo_runners_instance

⇑ Back to ToC ⇑

URL of the Forgejo instance to register the runners

  • Type: str
  • Required: No

forgejo_runners

⇑ Back to ToC ⇑

List of runners to configure

The key is the name of the repository on the instance

The value is a dict with a token key and optionally a dict of labels

  • Type: dict
  • Required: No

Usage

Example of a basic forgejo.yml playbook:

- hosts: forgejo
  roles:
    - jriou.forgejo

Then run the playbook:

ansible-playbook forgejo.yml

Runners

Example of runners configuration:

- hosts: forgejo
  roles:
    - jriou.forgejo
  vars:
    forgejo_server: false
    forgejo_runners_instance: https://codeberg.org  # FIXME
    forgejo_runners:
      coller:
        token: **redacted**
        labels:
          debian12: docker://data.forgejo.org/oci/debian:bookworm
          debian13: docker://data.forgejo.org/oci/debian:trixie
      ansible:
        token: **redacted**
        labels:
          docker: docker://data.forgejo.org/oci/node:latest

Donate

As we all love FOSS projects, you should consider donating to Codeberg, the non-profit organization behind Forgejo.