Files
Kamino/roles/gitea/defaults/main.yml
T
Defame1297andClaude Opus 5.5 f060461152
Build / build (pull_request) Successful in 12s
Lint / lint (pull_request) Failing after 43s
Molecule / molecule (pull_request) Successful in 1m20s
feat(gitea): add the gitea role
Moves the gitea role from the environment repository, the second wave 2 role and the
second caller of the internal _binary_update role.

Against the source:
- The update path stages the downloaded, signature-verified binary in a directory next to
  the live one and hands the stop, backup, swap, restart, version check and rollback to
  mortis.kamino._binary_update (include_role with apply tags, so --tags update reaches
  it). A download or signature failure still leaves the running service untouched and
  says so; a failure in the swap keeps the rollback message of _binary_update. Its default
  version regex is the one the source used.
- The same two small behaviour changes as for traefik come with _binary_update: the backup
  is taken whenever a live binary exists, and a failure before the stop no longer
  restarts the running service.
- The update no longer removes a PID file between the stop and the start, and
  gitea_pid_file is gone: the unit runs `gitea web` without --pid and has no PIDFile=,
  so Gitea writes no PID file and systemd reads none.
- The database-migration warning of the source's rollback message (the previous binary
  may refuse a migrated schema) moves to the gitea_update docs in the README and the
  argument_specs, since _binary_update owns the failure message.
- The legacy name guard (pre-rename variables of the environment) is dropped, as in the
  wave 1 roles, and the argument_specs and README no longer mention it. The jwt secret,
  mailer and e-mail confirmation asserts stay.
- Environment references are gone from comments, app.ini.j2, the README and the
  argument_specs: issue numbers, decision records, host names, inventory paths,
  playbooks, the network and proxy layout and other roles' copies of the paths. The
  Renovate comment on gitea_version is dropped; the README and argument_specs recommend
  pinning the version in inventory. The mint messages no longer name a playbook.
- On a fresh host the token assert and the SSH-key upload ran before the unit was
  written and Gitea started, so a first install could never complete. Both now run after
  the service check, and the upload first waits (up to 60 s, not under --check) for the
  local listener; the listener address is resolved once for both.
- REVERSE_PROXY_LIMIT, hard-coded to 2, is now gitea_reverse_proxy_limit with default 1:
  a limit above the real number of proxies lets a client forge the address Gitea logs and
  Fail2Ban bans. A setup with two proxies sets it to 2.
- The gitea commands with user-supplied values (migrate, admin user list and create, and
  the token mint) take argv instead of a command string; still run through sudo -u.
- gitea_version is asserted at role start to be a plain X.Y.Z, with no leading v.
- meta namespace mortis; the scenario follows the Kamino conventions (header,
  test_sequence, no provisioner env) and calls the role by FQCN, also in the child
  ansible-playbook of the mint CI-guard cases. Coverage is unchanged.

No other default changed; DISABLE_REGISTRATION stays hard-coded to true.

Changelog fragment, README Roadmap and the CLAUDE.md role list updated.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MmzvM9skAvYcph2c9EiPcm
2026-11-21 21:53:20 +00:00

81 lines
3.0 KiB
YAML

---
gitea_update: false
gitea_remove_data: false
gitea_remove: false
# Moves only with a Collection release: pin it in inventory to move Gitea on your own schedule.
gitea_version: "28.4.0"
gitea_download_url: "https://dl.gitea.com/gitea/{{ gitea_version }}/gitea-{{ gitea_version }}-linux-amd64"
gitea_signature_url: "{{ gitea_download_url }}.asc"
gitea_gpg_key_id: "7C9E68152594688862D62AF62D9AE806EC1592E2"
# Fetched on every download into a throwaway keyring; the check accepts only signatures by
# gitea_gpg_key_id, so the source can serve that key or nothing useful.
gitea_gpg_key_url: "https://keys.openpgp.org/vks/v1/by-fingerprint/{{ gitea_gpg_key_id | upper }}"
gitea_user: "git"
gitea_group: "git"
gitea_home: "/home/git"
gitea_install_dir: "/usr/local/bin"
gitea_app_dir: "/etc/gitea"
gitea_data_dirs: # order of dirs is important and should be kept static!
- "/var/lib/gitea"
- "/var/lib/gitea/custom"
- "/var/lib/gitea/data"
- "/var/lib/gitea/log"
gitea_service_unit: "/etc/systemd/system/gitea.service"
gitea_http_port: 3000
gitea_http_addr: "127.0.0.1"
# REVERSE_PROXY_LIMIT: trusted proxy hops in X-Forwarded-For. Set it to the real number of
# proxies in front of Gitea; a higher value lets a client forge the address Gitea logs and
# Fail2Ban bans.
gitea_reverse_proxy_limit: 1
gitea_bash_completion_path: "/usr/share/bash-completion/completions/gitea"
# Outgoing mail ([mailer] in app.ini). Off by default: while false no [mailer]
# section is rendered and ENABLE_NOTIFY_MAIL stays false. When true, the
# address, sender, user and password must be set (asserted at role start).
gitea_mailer_enabled: false
gitea_mailer_protocol: "smtp+starttls"
gitea_mailer_smtp_addr: ""
gitea_mailer_smtp_port: 587
gitea_mailer_from: ""
gitea_mailer_user: ""
gitea_mailer_passwd: ""
gitea_mailer_subject_prefix: ""
# REGISTER_EMAIL_CONFIRM: new accounts and newly added e-mail addresses must be
# confirmed by a mailed link. Needs gitea_mailer_enabled (asserted).
gitea_register_email_confirm: false
# DEFAULT_EMAIL_NOTIFICATIONS ([admin]): notification mail setting of new
# users (enabled, onmention, disabled); each user can change their own.
# Rendered only while gitea_mailer_enabled is true.
gitea_default_email_notifications: "enabled"
# Gitea logs to journald (console mode, no [log] file section configured),
# so the jail reads it via journalmatch rather than a logpath.
gitea_fail2ban_jail:
enabled: true
port: "http,https"
filter: gitea
journalmatch: "_SYSTEMD_UNIT=gitea.service"
maxretry: 5
bantime: "1h"
findtime: "10m"
gitea_fail2ban_filter:
failregex: '^.*Failed authentication attempt for .* from <HOST>.*$'
gitea_ufw_service_rules:
- rule: allow
port: "{{ gitea_http_port }}"
from: "127.0.0.1"
proto: tcp
comment: "Allow Gitea only from IPv4 localhost"
- rule: allow
port: "{{ gitea_http_port }}"
from: "::1"
proto: tcp
comment: "Allow Gitea only from IPv6 localhost"
- rule: deny
port: "{{ gitea_http_port }}"
proto: tcp
comment: "Deny Gitea from outside"