You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This role installs and manages gitea - Git with a cup of tea. A painless self-hosted Git service. Gitea is a community managed lightweight code hosting solution written in Go.
Source code & screenshots.
Sample example of use in a playbook
The following code has been tested with the latest Debian Stable, it should work on Ubuntu and RedHat as well.
# ansible-galaxy install do1jlr.gitea
- name: "Install gitea"hosts: git.example.comroles:
- {role: do1jlr.gitea, tags: gitea}vars:
# Here we assume we are behind a reverse proxy that will# handle https for us, so we bind on localhost:3000 using HTTPgitea_fqdn: 'git.example.com'gitea_root_url: 'https://git.example.com'gitea_protocol: httpgitea_start_ssh: true
Variables
Here is a deeper insight into the variables of this gitea role. For the exact function of some variables and the possibility to add more options we recommend a look at this config cheat sheet.
gitea update mechanism
To determine which gitea version to install, you can choose between two variants.
Either you define exactly which release you install. Or you use the option latest to always install the latest release from the gitea releases.
gitea update
variable name
default value
description
gitea_version
WILL CHANGE SOON
Define either the exact release to install or use latest to install the latest release.
gitea_version_check
true
Check if installed version != gitea_version before initiating binary download
gitea_gpg_key
7C9E68152594688862D62AF62D9AE806EC1592E2
the gpg key the gitea binary is signed with
gitea_gpg_server
hkps://keys.openpgp.org
A gpg key server where this role can download the gpg key
gitea_backup_on_upgrade
false
Optionally a backup can be created with every update of gitea.
gitea_backup_location
{{ gitea_home }}/backups/
Where to store the gitea backup if one is created with this role.
submodules_versioncheck
false
a simple version check that can prevent you from accidentally running an older version of this role. (recomended)
gitea in the linux world
variable name
default value
description
gitea_group
gitea
UNIX group used by Gitea
gitea_home
/var/lib/gitea
Base directory to work
gitea_shell
/bin/false
UNIX shell used by gitea. Set it to /bin/bash if you don't use the gitea built-in ssh server.
gitea_systemd_cap_net_bind_service
false
Adds AmbientCapabilities=CAP_NET_BIND_SERVICE to systemd service file
Oauth2 JWT secret. Can be generated with gitea generate secret JWT_SECRET. Will be autogenerated if not defined.
gitea_oauth2_extra_config
''
you can use this variable to pass additional config parameters in the [oauth2] section of the config.
additional gitea config
variable name
default value
description
gitea_extra_config
''
Additional gitea configuration. Have a look at the config-cheat-sheet before using it!
Fail2Ban configuration
If enabled, this will deploy a fail2ban filter and jail config for Gitea as described in the Gitea Documentation.
As this will only deploy config files, fail2ban already has to be installed or otherwise the role will fail.
variable name
default value
description
gitea_fail2ban_enabled
false
Whether to deploy the fail2ban config or not
gitea_fail2ban_jail_maxretry
10
fail2ban jail maxretry setting.
gitea_fail2ban_jail_findtime
3600
fail2ban jail findtime setting.
gitea_fail2ban_jail_bantime
900
fail2ban jail bantime setting.
gitea_fail2ban_jail_action
iptables-allports
fail2ban jail action setting.
optional customisation
You can optionally customize your gitea using this ansible role. We got our information about customisation from docs.gitea.io/en-us/customizing-gitea.
To deploy multiple files we created the gitea_custom_search variable, that can point to the path where you put the custom gitea files ( default "files/host_files/{{ inventory_hostname }}/gitea").
LOGO:
Set gitea_customize_logo to true
We search for:
logo.svg - Used for favicon, site icon, app icon
logo.png - Used for Open Graph
favicon.png - Used as fallback for browsers that don’t support SVG favicons
apple-touch-icon.png - Used on iOS devices for bookmarks
this ansible role was originally developed on github.com/thomas-maurice/ansible-role-gitea. Since the role there has some problems like default values for the location of the gitea repositories and the merging of pull requests usually takes several months, a fork of the role was created that offers the same. Only tidier and with the claim to react faster to issues and pull requests.