From 9a306158c2df590a41547463acbe24aeae084b3a Mon Sep 17 00:00:00 2001 From: L3D Date: Wed, 30 Aug 2023 01:08:02 +0200 Subject: [PATCH] cleanup variable name and values Variable names cleanup added ternary('true', 'false') where needed default value for new variables now the same than the official docs --- README.md | 10 ++++++++++ defaults/main.yml | 21 ++++++++++----------- tasks/configure.yml | 8 ++++++++ templates/gitea.ini.j2 | 21 +++++++++++---------- vars/main.yml | 2 +- 5 files changed, 40 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index 1bfd033..1b69432 100644 --- a/README.md +++ b/README.md @@ -221,6 +221,16 @@ Either you define exactly which release you install. Or you use the option ``lat | `gitea_only_allow_external_registration` | `false` | Set to true to force registration only using third-party services (true/false) | | `gitea_enable_notify_mail` | `false` | Enable this to send e-mail to watchers of a repository when something happens, like creating issues (true/false) | | `gitea_auto_watch_new_repos` | `true` | Enable this to let all organisation users watch new repos when they are created (true/false) | +| `gitea_autowatch_on_change` | `true` | Enable this to make users watch a repository after their first commit to it (true/false) | +| `gitea_register_manual_confirm` | `false` | Enable this to manually confirm new registrations. Requires REGISTER_EMAIL_CONFIRM to be disabled. | +| `gitea_default_allow_create_organization` | `true` | Allow new users to create organizations by default (true/false) | +| `gitea_email_domain_allowlist` | | If non-empty, comma separated list of domain names that can only be used to register on this instance, wildcard is supported. | +| `gitea_default_user_visibility` | `public` | Set default visibility mode for users, either "public", "limited" or "private". | +| `gitea_default_org_visibility` | `public` | Set default visibility mode for organisations, either "public", "limited" or "private". | +| `gitea_allow_only_internal_registration` | `false` | Set to true to force registration only via Gitea. | +| `gitea_allow_only_external_registration` | `false` | Set to true to force registration only using third-party services. | +| `gitea_show_milestones_dashboard_page` | `true` | Enable this to show the milestones dashboard page - a view of all the user's milestones | +| `gitea_default_user_is_restricted` | `false` | Give new users restricted permissions by default (true/false) | | `gitea_service_extra_config` | | you can use this variable to pass additional config parameters in the `[service]` section of the config. | ### Mailer ([mailer](https://docs.gitea.io/en-us/config-cheat-sheet/#mailer-mailer)) diff --git a/defaults/main.yml b/defaults/main.yml index 16a01dd..62c2fa4 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -156,25 +156,24 @@ gitea_security_extra_config: '' # -> https://docs.gitea.io/en-us/config-cheat-sheet/#service-service gitea_disable_registration: false gitea_register_email_confirm: false +gitea_register_manual_confirm: false gitea_require_signin: true gitea_default_keep_mail_private: true gitea_enable_captcha: true gitea_show_registration_button: true gitea_only_allow_external_registration: false gitea_enable_notify_mail: false -gitea_service_extra_config: '' -gitea_auto_watch_new_repos: false -gitea_autowatch_on_change: true -# make sure, that register_email_confirm is false when register_manual_confirm is set to true -gitea_register_manual_confirm: true +gitea_auto_watch_new_repos: true +gitea_autowatch_on_change: false gitea_default_allow_create_organization: false -gitea_default_user_is_restricted: true +gitea_default_user_is_restricted: false gitea_email_domain_allowlist: "" -gitea_default_user_visibility: limited -gitea_default_org_visibility: limited -gitea_allow_only_internal_registration: true -gitea_show_mailstones_dashboard: true -# gitea_email_domain_allowlist: "" +gitea_default_user_visibility: public +gitea_default_org_visibility: public +gitea_allow_only_internal_registration: false +gitea_allow_only_external_registration: false +gitea_show_milestones_dashboard_page: true +gitea_service_extra_config: '' # Mailer [mailer] # -> https://docs.gitea.io/en-us/config-cheat-sheet/#mailer-mailer diff --git a/tasks/configure.yml b/tasks/configure.yml index 3f1be1f..a5f5f30 100644 --- a/tasks/configure.yml +++ b/tasks/configure.yml @@ -1,4 +1,12 @@ --- +- name: Make sure gitea_register_email_confirm is false when gitea_register_manual_confirm is true + ansible.builtin.fail: + msg: | + To manually confirm registrations, + gitea_register_email_confirm needs to be false + and gitea_register_manual_confirm should be true. + when: gitea_register_manual_confirm | bool and gitea_register_email_confirm | bool + - name: "Configure gitea" become: true ansible.builtin.template: diff --git a/templates/gitea.ini.j2 b/templates/gitea.ini.j2 index 6409b7f..e7be89c 100644 --- a/templates/gitea.ini.j2 +++ b/templates/gitea.ini.j2 @@ -175,17 +175,18 @@ DEFAULT_KEEP_EMAIL_PRIVATE = {{ gitea_default_keep_mail_private | ternary('true' SHOW_REGISTRATION_BUTTON = {{ gitea_show_registration_button | ternary('true', 'false') }} AUTO_WATCH_NEW_REPOS = {{ gitea_auto_watch_new_repos | ternary('true', 'false') }} ALLOW_ONLY_EXTERNAL_REGISTRATION = {{ gitea_only_allow_external_registration | ternary('true', 'false') }} -AUTO_WATCH_ON_CHANGES = {{ gitea_autowatch_on_change }} -SHOW_MILESTONES_DASHBOARD_PAGE = {{ gitea_show_mailstones_dashboard }} -REGISTER_MANUAL_CONFIRM = {{ gitea_register_manual_confirm }} -DEFAULT_ALLOW_CREATE_ORGANIZATION = {{ gitea_default_allow_create_organization }} -DEFAULT_USER_IS_RESTRICTED = {{ gitea_default_user_is_restricted }} -{% if gitea_email_domain_allowlist is defined and gitea_email_domain_allowlist|length %} +AUTO_WATCH_ON_CHANGES = {{ gitea_autowatch_on_change | ternary('true', 'false') }} +SHOW_MILESTONES_DASHBOARD_PAGE = {{ gitea_show_milestones_dashboard_page | ternary('true', 'false') }} +REGISTER_MANUAL_CONFIRM = {{ gitea_register_manual_confirm | ternary('true', 'false') }} +DEFAULT_ALLOW_CREATE_ORGANIZATION = {{ gitea_default_allow_create_organization | ternary('true', 'false') }} +DEFAULT_USER_IS_RESTRICTED = {{ gitea_default_user_is_restricted | ternary('true', 'false') }} +{% if gitea_email_domain_allowlist is defined and gitea_email_domain_allowlist | length %} EMAIL_DOMAIN_ALLOWLIST = {{ gitea_email_domain_allowlist }} {% endif %} -DEFAULT_USER_VISIBILITY = {{ gitea_default_user_visibility }} -DEFAULT_ORG_VISIBILITY = {{ gitea_default_org_visibility }} -ALLOW_ONLY_INTERNAL_REGISTRATION = {{ gitea_allow_only_internal_registration }} +DEFAULT_USER_VISIBILITY = {{ gitea_default_user_visibility | ternary('true', 'false') }} +DEFAULT_ORG_VISIBILITY = {{ gitea_default_org_visibility | ternary('true', 'false') }} +ALLOW_ONLY_INTERNAL_REGISTRATION = {{ gitea_allow_only_internal_registration | ternary('true', 'false') }} +ALLOW_ONLY_EXTERNAL_REGISTRATION = {{ gitea_allow_only_external_registration | ternary('true', 'false') }} {{ gitea_service_extra_config }} ; ; @@ -308,4 +309,4 @@ ENABLE_FEED = {{ gitea_other_enable_feed | ternary('true', 'false') }} ; ; ; Optional additional config -{{ gitea_extra_config }} \ No newline at end of file +{{ gitea_extra_config }} diff --git a/vars/main.yml b/vars/main.yml index 70d6b20..87f226a 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -62,5 +62,5 @@ transfer_custom_footer: - 'files/gitea_footer/extra_links_footer.tmpl' - 'files/extra_links_footer.tmpl' -playbook_version_number: 49 # should be int +playbook_version_number: 50 # should be int playbook_version_path: 'do1jlr.gitea.version'