diff --git a/README.md b/README.md index 41a970c..1116f1c 100644 --- a/README.md +++ b/README.md @@ -56,6 +56,8 @@ The following code has been tested with Debian 8, it should work on Ubuntu as we * `gitea_version_check`: Check if installed version != `gitea_version` before initiating binary download * `gitea_user`: UNIX user used by Gitea * `gitea_home`: Base directory to work +* `gitea_dl_url`: The URL, the compiled gitea-binary will be downloaded from +* `gitea_systemd_cap_net_bind_service`: Adds `AmbientCapabilities=CAP_NET_BIND_SERVICE` to systemd service file ### Look and feel @@ -64,11 +66,14 @@ The following code has been tested with Debian 8, it should work on Ubuntu as we * `gitea_disable_gravatar`: Do you want to disable Gravatar ? (privacy and so on) (true/false) * `gitea_offline_mode`: Same but for disabling CDNs for frontend assets (true/false) * `gitea_disable_registration`: Do you want to disable user registration ? (true/false) +* `gitea_only_allow_external_registration`: Do you want to force registration only using third-party services ? (true/false) * `gitea_show_registration_button`: Do you want to show the registration button? (true/false) * `gitea_require_signin`: Do you require a signin to see repo's (even public ones) ? (true/false) * `gitea_enable_captcha`: Do you want to enable captcha's ? (true/false) * `gitea_secret_key`: Cookie secret key * `gitea_internal_token`: Internal API token +* `gitea_themes`: List of enabled themes +* `gitea_theme_default`: Default theme ### Limits diff --git a/defaults/main.yml b/defaults/main.yml index 174d4fd..6fe1141 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,12 +1,15 @@ --- gitea_version: "1.12.0" gitea_version_check: true +gitea_dl_url: "https://github.com/go-gitea/gitea/releases/download/v{{ gitea_version }}/gitea-{{ gitea_version }}-linux-{{ gitea_arch }}" gitea_app_name: "Gitea" gitea_user: "gitea" gitea_home: "/var/lib/gitea" gitea_shell: "/bin/false" +gitea_systemd_cap_net_bind_service: false +gitea_repository_root: "{{ gitea_home }}" gitea_user_repo_limit: -1 gitea_http_domain: localhost @@ -42,6 +45,7 @@ gitea_disable_registration: false gitea_show_registration_button: true gitea_require_signin: true gitea_enable_captcha: true +gitea_only_allow_external_registration: false gitea_force_private: false @@ -64,3 +68,6 @@ gitea_oauth2_jwt_secret: ChangeMe gitea_metrics_enabled: false gitea_metrics_token: ~ + +gitea_themes: gitea,arc-green +gitea_theme_default: gitea diff --git a/tasks/main.yml b/tasks/main.yml index ca9912d..00c2fe1 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -4,6 +4,8 @@ - name: "Check gitea version" shell: "set -eo pipefail; /usr/local/bin/gitea -v | cut -d' ' -f 3" + args: + executable: /bin/bash register: gitea_active_version changed_when: false failed_when: false @@ -11,7 +13,7 @@ - name: "Download the binary" get_url: - url: "{{ gitea_dl_url }}/v{{ gitea_version }}/gitea-{{ gitea_version }}-linux-{{ gitea_arch }}" + url: "{{ gitea_dl_url }}" dest: /usr/local/bin/gitea owner: root group: root diff --git a/templates/gitea.ini.j2 b/templates/gitea.ini.j2 index a57d626..eee69d3 100644 --- a/templates/gitea.ini.j2 +++ b/templates/gitea.ini.j2 @@ -13,7 +13,7 @@ RUN_USER = {{ gitea_user }} RUN_MODE = prod [repository] -ROOT = {{ gitea_home }} +ROOT = {{ gitea_repository_root }} ; Force every new repository to be private FORCE_PRIVATE = {{ gitea_force_private }} ; Global limit of repositories per user, applied at creation time. -1 means no limit @@ -26,6 +26,8 @@ DISABLE_HTTP_GIT = {{ gitea_disable_http_git }} [ui] ; Whether the email of the user should be shown in the Explore Users page SHOW_USER_EMAIL = {{ gitea_show_user_email }} +THEMES = {{ gitea_themes }} +DEFAULT_THEME = {{ gitea_theme_default }} [server] ; The protocol the server listens on. One of 'http', 'https', 'unix' or 'fcgi'. @@ -109,6 +111,7 @@ RECAPTCHA_SECRET = RECAPTCHA_SITEKEY = ; Show Registration button SHOW_REGISTRATION_BUTTON = {{ gitea_show_registration_button }} +ALLOW_ONLY_EXTERNAL_REGISTRATION = {{ gitea_only_allow_external_registration }} [mailer] ENABLED = {{ gitea_mailer_enabled }} diff --git a/templates/gitea.service.j2 b/templates/gitea.service.j2 index c746cc4..f7c004d 100644 --- a/templates/gitea.service.j2 +++ b/templates/gitea.service.j2 @@ -7,6 +7,9 @@ User={{ gitea_user }} ExecStart=/usr/local/bin/gitea web -c /etc/gitea/gitea.ini Restart=on-failure WorkingDirectory={{ gitea_home }} +{% if gitea_systemd_cap_net_bind_service %} +AmbientCapabilities=CAP_NET_BIND_SERVICE +{% endif %} [Install] WantedBy=multi-user.target diff --git a/vars/main.yml b/vars/main.yml index 3581cfb..9ec5113 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -1,3 +1,2 @@ --- gitea_arch: "{{ 'amd64' if ansible_architecture == 'x86_64' else ansible_architecture }}" -gitea_dl_url: "https://github.com/go-gitea/gitea/releases/download"