Go to file
Franca Debole 10309761c8 aligned 2026-08-21 17:41:25 +02:00
defaults defined vars as are defined on the gitea role 2026-08-21 16:05:34 +02:00
handlers The systemd unit is now a template. Refactor to satisfy the ansible-lint rules. 2026-08-06 12:15:20 +02:00
meta aligned 2026-08-21 17:41:25 +02:00
tasks name of variables on defaults/main described as ini-session_ini-variable 2026-08-21 14:31:34 +02:00
templates name of variables on defaults/main described as ini-session_ini-variable 2026-08-21 14:31:34 +02:00
tests The systemd unit is now a template. Refactor to satisfy the ansible-lint rules. 2026-08-06 12:15:20 +02:00
.ansible-lint The systemd unit is now a template. Refactor to satisfy the ansible-lint rules. 2026-08-06 12:15:20 +02:00
.gitignore aligned 2026-08-21 17:41:25 +02:00
LICENSE Initial commit 2026-08-05 17:03:47 +02:00
README.md typo on readme 2026-08-13 17:51:26 +02:00

README.md

Forgejo

A role that installs forgejo, the self-hosted lightweight software forge. The role downloads the forgejo binary, creates the service user and the directory layout, and installs the systemd unit from a template so that optional dependencies (memcached, redis, a local database) can be declared as Wants=/After= directives.

The application configuration (app.ini) is not managed by this role.

Requirements

None. git and git-lfs are installed by the role.

Role Variables

The most important variables are listed below:

forgejo_version: 10.0.0
forgejo_arch: linux-amd64
forgejo_download_url: 'https://codeberg.org/forgejo/forgejo/releases/download/{{ forgejo_tag }}/forgejo-{{ forgejo_version }}-{{ forgejo_arch }}'
# Set it to true to download the binary again even when it is already there
forgejo_force_binary_download: false
forgejo_bin_path: /usr/local/bin/forgejo

# The service user. forgejo upstream uses the 'git' user
git_create_service_user: true
git_user: git
git_group: '{{ git_user }}'
git_home: /home/git

# FORGEJO_WORK_DIR, and where app.ini lives
forgejo_work_dir: /var/lib/forgejo
forgejo_conf_dir: /etc/forgejo

forgejo_enabled: true
forgejo_service_name: forgejo

Systemd unit tuning:

# Raise it if you have repositories with a lot of files and you get HTTP 500
# errors because of that
forgejo_limit_nofile: ''
# Set it when forgejo listens on a unix socket: systemd creates /run/<dir>
forgejo_runtime_dir: ''
# Set it if git and/or git-lfs are not installed inside the default PATH
forgejo_path_env: ''
# Set it to true to let forgejo bind ports below 1024
forgejo_bind_privileged_ports: false

Service dependencies. Every service enabled below is added to the systemd unit as a Wants=/After= pair:

forgejo_local_postgresql: false
forgejo_local_mysql: false
forgejo_local_mariadb: false
forgejo_local_memcache: false
forgejo_local_redis: false
# Any other unit, by name
forgejo_service_dependencies_adjunct: []

The unit names can be overridden when they differ from the distribution defaults: forgejo_redis_service_name, forgejo_memcached_service_name, forgejo_postgresql_service_name, forgejo_mysql_service_name, forgejo_mariadb_service_name.

Tags

  • forgejo: everything
  • forgejo_binary: the binary download only
  • forgejo_service: the systemd unit and the service state only
  • forgejo_prepare: download the app.example.ini and save the variables of the Forgejo configuration as variables of the role.
  • forgejo_conf: apply the template forgejo.ini.j2 to save the configuration file app.ini reading the vars/main variables.

Dependencies

The memcached and redis roles, installed only when forgejo_local_memcache and/or forgejo_local_redis are true.

Example Playbook

- hosts: forgejo-servers
  roles:
    - role: forgejo
      forgejo_version: 10.0.0
      forgejo_local_postgresql: true
      forgejo_local_redis: true
      forgejo_local_memcache: true

License

EUPL-1.2

Author Information

Andrea DellAmico, andrea.dellamico@isti.cnr.it Franca Debole, franca.debole@isti.cnr.it