From e118d2f7cb45df2fdd108887566b8f9a9839af98 Mon Sep 17 00:00:00 2001 From: Lyn Matten Date: Tue, 29 Aug 2023 08:52:06 +0200 Subject: [PATCH 01/31] added several config options for service section --- defaults/main.yml | 13 +++++++++++++ templates/gitea.ini.j2 | 15 +++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/defaults/main.yml b/defaults/main.yml index bb04b91..ef25d10 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -164,6 +164,19 @@ gitea_only_allow_external_registration: false gitea_enable_notify_mail: false gitea_auto_watch_new_repos: true gitea_service_extra_config: '' +gitea_autowatch_new_repo: false +gitea_autowatch_on_change: true +# make sure, that register_email_confirm is false when register_manual_confirm is set to true +gitea_register_email_confirm: false +gitea_register_manual_confirm: true +gitea_default_allow_create_organization: false +gitea_default_user_is_restricted: true +gitea_email_domain_allowlist: "" +gitea_auto_watch_new_repos: false +gitea_default_user_visibility: limited +gitea_default_org_visibility: limited +gitea_allow_only_internal_registration: true +# gitea_email_domain_allowlist: "" # Mailer [mailer] # -> https://docs.gitea.io/en-us/config-cheat-sheet/#mailer-mailer diff --git a/templates/gitea.ini.j2 b/templates/gitea.ini.j2 index cbe7cb2..c25365d 100644 --- a/templates/gitea.ini.j2 +++ b/templates/gitea.ini.j2 @@ -174,6 +174,21 @@ DEFAULT_KEEP_EMAIL_PRIVATE = {{ gitea_default_keep_mail_private | ternary 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') }} +; new +AUTO_WATCH_NEW_REPOS = {{ gitea_autowatch_new_repo }} +AUTO_WATCH_ON_CHANGES = {{ gitea_autowatch_on_change }} +SHOW_MILESTONES_DASHBOARD_PAGE = {{ gitea_show_mailstones_dashboard }} +REGISTER_EMAIL_CONFIRM = {{ gitea_register_email_confirm }} +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 %} +EMAIL_DOMAIN_ALLOWLIST = {{ gitea_email_domain_allowlist }} +{% endif %} +AUTO_WATCH_NEW_REPOS = {{ gitea_auto_watch_new_repos }} +DEFAULT_USER_VISIBILITY = {{ gitea_default_user_visibility }} +DEFAULT_ORG_VISIBILITY = {{ gitea_default_org_visibility }} +ALLOW_ONLY_INTERNAL_REGISTRATION = {{ gitea_allow_only_internal_registration }} {{ gitea_service_extra_config }} ; ; From d08647ef84be66a7f9da1701aa4bbee06c3e3e96 Mon Sep 17 00:00:00 2001 From: Lyn Matten Date: Tue, 29 Aug 2023 09:01:20 +0200 Subject: [PATCH 02/31] removed with spaces to avoid unneccesary redeplyoment of variables --- templates/gitea.ini.j2 | 236 ++++++++++++++++++++--------------------- 1 file changed, 118 insertions(+), 118 deletions(-) diff --git a/templates/gitea.ini.j2 b/templates/gitea.ini.j2 index c25365d..9009e5d 100644 --- a/templates/gitea.ini.j2 +++ b/templates/gitea.ini.j2 @@ -13,39 +13,39 @@ RUN_MODE = {{ gitea_run_mode }} ; ; -> https://docs.gitea.io/en-us/config-cheat-sheet/#repository-repository [repository] -ROOT = {{ gitea_repository_root }} -FORCE_PRIVATE = {{ gitea_force_private | ternary('true', 'false') }} -DEFAULT_PRIVATE = {{ gitea_default_private }} -MAX_CREATION_LIMIT = {{ gitea_user_repo_limit }} -DISABLE_HTTP_GIT = {{ gitea_disable_http_git | ternary('true', 'false') }} +ROOT = {{ gitea_repository_root }} +FORCE_PRIVATE = {{ gitea_force_private | ternary('true', 'false') }} +DEFAULT_PRIVATE = {{ gitea_default_private }} +MAX_CREATION_LIMIT = {{ gitea_user_repo_limit }} +DISABLE_HTTP_GIT = {{ gitea_disable_http_git | ternary('true', 'false') }} ENABLE_PUSH_CREATE_USER = {{ gitea_enable_push_create_user | ternary('true', 'false') }} -ENABLE_PUSH_CREATE_ORG = {{ gitea_enable_push_create_org | ternary('true', 'false') }} -DISABLED_REPO_UNITS = {{ gitea_disabled_repo_units }} -DEFAULT_REPO_UNITS = {{ gitea_default_repo_units }} -DISABLE_STARS = {{ gitea_disable_stars | ternary('true', 'false') }} -DEFAULT_BRANCH = {{ gitea_default_branch }} +ENABLE_PUSH_CREATE_ORG = {{ gitea_enable_push_create_org | ternary('true', 'false') }} +DISABLED_REPO_UNITS = {{ gitea_disabled_repo_units }} +DEFAULT_REPO_UNITS = {{ gitea_default_repo_units }} +DISABLE_STARS = {{ gitea_disable_stars | ternary('true', 'false') }} +DEFAULT_BRANCH = {{ gitea_default_branch }} {{ gitea_repository_extra_config }} ; ; ; -> https://docs.gitea.io/en-us/administration/config-cheat-sheet/#repository---upload-repositoryupload [repository.upload] -ENABLED = {{ gitea_repository_upload_enabled | ternary('true', 'false') }} -TEMP_PATH = {{ gitea_home }}/data/tmp/uploads -FILE_MAX_SIZE = {{ gitea_repository_upload_max_size }} +ENABLED = {{ gitea_repository_upload_enabled | ternary('true', 'false') }} +TEMP_PATH = {{ gitea_home }}/data/tmp/uploads +FILE_MAX_SIZE = {{ gitea_repository_upload_max_size }} {{ gitea_repository_upload_extra_config }} ; ; {% if gitea_enable_repo_signing_options | bool %} ; -> https://docs.gitea.io/en-us/config-cheat-sheet/#repository---signing-repositorysigning [repository.signing] -SIGNING_KEY = {{ gitea_repo_signing_key }} -SIGNING_NAME = {{ gitea_repo_signing_name }} -SIGNING_EMAIL = {{ gitea_repo_signing_email }} -INITIAL_COMMIT = {{ gitea_repo_initial_commit }} +SIGNING_KEY = {{ gitea_repo_signing_key }} +SIGNING_NAME = {{ gitea_repo_signing_name }} +SIGNING_EMAIL = {{ gitea_repo_signing_email }} +INITIAL_COMMIT = {{ gitea_repo_initial_commit }} DEFAULT_TRUST_MODEL = {{ gitea_repo_default_trust_model }} -WIKI = {{ gitea_repo_wiki }} -CRUD_ACTIONS = {{ gitea_repo_crud_actions }} -MERGES = {{ gitea_repo_merges }} +WIKI = {{ gitea_repo_wiki }} +CRUD_ACTIONS = {{ gitea_repo_crud_actions }} +MERGES = {{ gitea_repo_merges }} {{ gitea_enable_repo_signing_extra }} ; {% endif %} @@ -54,94 +54,94 @@ MERGES = {{ gitea_repo_merges }} ; ; -> https://docs.gitea.io/en-us/config-cheat-sheet/#cors-cors [cors] -ENABLED = {{ gitea_enable_cors | ternary('true', 'false') }} -SCHEME = {{ gitea_cors_scheme }} -ALLOW_DOMAIN = {{ gitea_cors_allow_domain }} -ALLOW_SUBDOMAIN = {{ gitea_cors_allow_subdomain | ternary('true', 'false') }} -METHODS = {{ gitea_cors_methods }} -MAX_AGE = {{ gitea_cors_max_age }} +ENABLED = {{ gitea_enable_cors | ternary('true', 'false') }} +SCHEME = {{ gitea_cors_scheme }} +ALLOW_DOMAIN = {{ gitea_cors_allow_domain }} +ALLOW_SUBDOMAIN = {{ gitea_cors_allow_subdomain | ternary('true', 'false') }} +METHODS = {{ gitea_cors_methods }} +MAX_AGE = {{ gitea_cors_max_age }} ALLOW_CREDENTIALS = {{ gitea_cors_allow_credentials | ternary('true', 'false') }} -HEADERS = {{ gitea_cors_headers }} -X_FRAME_OPTIONS = {{ gitea_cors_x_frame_options }} +HEADERS = {{ gitea_cors_headers }} +X_FRAME_OPTIONS = {{ gitea_cors_x_frame_options }} {{ gitea_cors_extra }} ; {% endif %} ; ; -> https://docs.gitea.io/en-us/config-cheat-sheet/#ui-ui [ui] -THEMES = {{ gitea_themes }} -DEFAULT_THEME = {{ gitea_theme_default }} -SHOW_USER_EMAIL = {{ gitea_show_user_email | ternary('true', 'false') }} +THEMES = {{ gitea_themes }} +DEFAULT_THEME = {{ gitea_theme_default }} +SHOW_USER_EMAIL= {{ gitea_show_user_email | ternary('true', 'false') }} {{ gitea_ui_extra_config }} ; ; ; [ui.meta] -AUTHOR = {{ gitea_ui_author }} +AUTHOR = {{ gitea_ui_author }} DESCRIPTION = {{ gitea_ui_description }} -KEYWORDS = {{ gitea_ui_keywords }} +KEYWORDS = {{ gitea_ui_keywords }} {{ gitea_ui_meta_extra_config }} ; ; ; -> https://docs.gitea.io/en-us/config-cheat-sheet/#server-server [server] -APP_DATA_PATH = {{ gitea_home }}/data -PROTOCOL = {{ gitea_protocol }} -DOMAIN = {{ gitea_http_domain }} -ROOT_URL = {{ gitea_root_url }} -HTTP_ADDR = {{ gitea_http_listen }} -HTTP_PORT = {{ gitea_http_port }} -START_SSH_SERVER = {{ gitea_start_ssh | ternary('true', 'false') }} -SSH_DOMAIN = {{ gitea_ssh_domain }} -SSH_PORT = {{ gitea_ssh_port }} -SSH_LISTEN_HOST = {{ gitea_ssh_listen }} -OFFLINE_MODE = {{ gitea_offline_mode | ternary('true', 'false') }} +APP_DATA_PATH = {{ gitea_home }}/data +PROTOCOL = {{ gitea_protocol }} +DOMAIN = {{ gitea_http_domain }} +ROOT_URL = {{ gitea_root_url }} +HTTP_ADDR = {{ gitea_http_listen }} +HTTP_PORT = {{ gitea_http_port }} +START_SSH_SERVER = {{ gitea_start_ssh | ternary('true', 'false') }} +SSH_DOMAIN = {{ gitea_ssh_domain }} +SSH_PORT = {{ gitea_ssh_port }} +SSH_LISTEN_HOST = {{ gitea_ssh_listen }} +OFFLINE_MODE = {{ gitea_offline_mode | ternary('true', 'false') }} {% if gitea_enable_tls_certs | bool %} -CERT_FILE = {{ gitea_tls_cert_file }} -KEY_FILE = {{ gitea_tls_key_file }} +CERT_FILE = {{ gitea_tls_cert_file }} +KEY_FILE = {{ gitea_tls_key_file }} {% endif %} -LANDING_PAGE = {{ gitea_landing_page }} +LANDING_PAGE = {{ gitea_landing_page }} {% if gitea_lfs_server_enabled | bool -%} -LFS_START_SERVER = true -LFS_JWT_SECRET = {{ gitea_lfs_jwt_secret }} +LFS_START_SERVER = true +LFS_JWT_SECRET = {{ gitea_lfs_jwt_secret }} {% endif %} -REDIRECT_OTHER_PORT = {{ gitea_redirect_other_port | ternary('true', 'false') }} -PORT_TO_REDIRECT = {{ gitea_port_to_redirect }} -ENABLE_ACME = {{ gitea_enable_acme | ternary('true', 'false') }} +REDIRECT_OTHER_PORT = {{ gitea_redirect_other_port | ternary('true', 'false') }} +PORT_TO_REDIRECT = {{ gitea_port_to_redirect }} +ENABLE_ACME = {{ gitea_enable_acme | ternary('true', 'false') }} {% if gitea_enable_acme | bool %} {% if gitea_acme_url != '' %} -ACME_URL = {{ gitea_acme_url }} +ACME_URL = {{ gitea_acme_url }} {% endif %} -ACME_ACCEPTTOS = {{ gitea_acme_accepttos | ternary('true', 'false') }} -ACME_DIRECTORY = {{ gitea_acme_directory }} -ACME_EMAIL = {{ gitea_acme_email }} -ACME_CA_ROOT = {{ gitea_acme_ca_root }} +ACME_ACCEPTTOS = {{ gitea_acme_accepttos | ternary('true', 'false') }} +ACME_DIRECTORY = {{ gitea_acme_directory }} +ACME_EMAIL = {{ gitea_acme_email }} +ACME_CA_ROOT = {{ gitea_acme_ca_root }} {% endif %} {{ gitea_server_extra_config }} ; ; ; -> https://docs.gitea.io/en-us/config-cheat-sheet/#database-database [database] -DB_TYPE = {{ gitea_db_type }} -HOST = {{ gitea_db_host }} -NAME = {{ gitea_db_name }} -USER = {{ gitea_db_user }} -PASSWD = {{ gitea_db_password }} +DB_TYPE = {{ gitea_db_type }} +HOST = {{ gitea_db_host }} +NAME = {{ gitea_db_name }} +USER = {{ gitea_db_user }} +PASSWD = {{ gitea_db_password }} SSL_MODE = {{ gitea_db_ssl }} -PATH = {{ gitea_db_path }} -LOG_SQL = {{ gitea_db_log_sql | ternary('true', 'false') }} +PATH = {{ gitea_db_path }} +LOG_SQL = {{ gitea_db_log_sql | ternary('true', 'false') }} {{ gitea_database_extra_config }} ; ; ; -> https://docs.gitea.io/en-us/config-cheat-sheet/#indexer-indexer [indexer] -ISSUE_INDEXER_PATH = {{ gitea_home }}/indexers/issues.bleve -REPO_INDEXER_ENABLED = {{ gitea_repo_indexer_enabled | ternary('true', 'false') }} -REPO_INDEXER_PATH = {{ gitea_home }}/indexers/repos.bleve -REPO_INDEXER_INCLUDE = {{ gitea_repo_indexer_include }} -REPO_INDEXER_EXCLUDE = {{ gitea_repo_indexer_exclude }} +ISSUE_INDEXER_PATH = {{ gitea_home }}/indexers/issues.bleve +REPO_INDEXER_ENABLED = {{ gitea_repo_indexer_enabled | ternary('true', 'false') }} +REPO_INDEXER_PATH = {{ gitea_home }}/indexers/repos.bleve +REPO_INDEXER_INCLUDE = {{ gitea_repo_indexer_include }} +REPO_INDEXER_EXCLUDE = {{ gitea_repo_indexer_exclude }} REPO_INDEXER_EXCLUDE_VENDORED = {{ gitea_repo_exclude_vendored | ternary('true', 'false') }} -MAX_FILE_SIZE = {{ gitea_repo_indexer_max_file_size }} +MAX_FILE_SIZE = {{ gitea_repo_indexer_max_file_size }} {{ gitea_indexer_extra_config }} ; ; @@ -154,26 +154,26 @@ DATADIR = {{ gitea_home }}/indexers/issues.queue ; ; -> https://docs.gitea.io/en-us/config-cheat-sheet/#security-security [security] -INSTALL_LOCK = true -SECRET_KEY = {{ gitea_secret_key }} -DISABLE_GIT_HOOKS = {{ gitea_disable_git_hooks | ternary('true', 'false') }} -DISABLE_WEBHOOKS = {{ gitea_disable_webhooks | ternary('true', 'false') }} -INTERNAL_TOKEN = {{ gitea_internal_token }} -PASSWORD_CHECK_PWN = {{ gitea_password_check_pwn | ternary('true', 'false') }} +INSTALL_LOCK = true +SECRET_KEY = {{ gitea_secret_key }} +DISABLE_GIT_HOOKS = {{ gitea_disable_git_hooks | ternary('true', 'false') }} +DISABLE_WEBHOOKS = {{ gitea_disable_webhooks | ternary('true', 'false') }} +INTERNAL_TOKEN = {{ gitea_internal_token }} +PASSWORD_CHECK_PWN = {{ gitea_password_check_pwn | ternary('true', 'false') }} {{ gitea_security_extra_config }} ; ; ; -> https://docs.gitea.io/en-us/config-cheat-sheet/#service-service [service] -REGISTER_EMAIL_CONFIRM = {{ gitea_register_email_confirm | ternary('true', 'false') }} -DISABLE_REGISTRATION = {{ gitea_disable_registration | ternary('true', 'false') }} -REQUIRE_SIGNIN_VIEW = {{ gitea_require_signin | ternary('true', 'false') }} -ENABLE_NOTIFY_MAIL = {{ gitea_enable_notify_mail | ternary('true', 'false') }} -ENABLE_CAPTCHA = {{ gitea_enable_captcha | ternary('true', 'false') }} -DEFAULT_KEEP_EMAIL_PRIVATE = {{ gitea_default_keep_mail_private | ternary('true', 'false') }} -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') }} +REGISTER_EMAIL_CONFIRM = {{ gitea_register_email_confirm | ternary('true', 'false') }} +DISABLE_REGISTRATION = {{ gitea_disable_registration | ternary('true', 'false') }} +REQUIRE_SIGNIN_VIEW = {{ gitea_require_signin | ternary('true', 'false') }} +ENABLE_NOTIFY_MAIL = {{ gitea_enable_notify_mail | ternary('true', 'false') }} +ENABLE_CAPTCHA = {{ gitea_enable_captcha | ternary('true', 'false') }} +DEFAULT_KEEP_EMAIL_PRIVATE = {{ gitea_default_keep_mail_private | ternary('true', 'false') }} +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') }} ; new AUTO_WATCH_NEW_REPOS = {{ gitea_autowatch_new_repo }} AUTO_WATCH_ON_CHANGES = {{ gitea_autowatch_on_change }} @@ -194,23 +194,23 @@ ALLOW_ONLY_INTERNAL_REGISTRATION = {{ gitea_allow_only_internal_registration }} ; ; -> https://docs.gitea.io/en-us/config-cheat-sheet/#mailer-mailer [mailer] -ENABLED = {{ gitea_mailer_enabled | ternary('true', 'false') }} +ENABLED = {{ gitea_mailer_enabled | ternary('true', 'false') }} {% if gitea_mailer_enabled | bool %} -PROTOCOL = {{ gitea_mailer_protocol }} -SMTP_ADDR = {{ gitea_mailer_smtp_addr }} -SMTP_PORT = {{ gitea_mailer_smtp_port }} -USE_CLIENT_CERT = {{ gitea_mailer_use_client_cert | ternary('true', 'false') }} +PROTOCOL = {{ gitea_mailer_protocol }} +SMTP_ADDR = {{ gitea_mailer_smtp_addr }} +SMTP_PORT = {{ gitea_mailer_smtp_port }} +USE_CLIENT_CERT = {{ gitea_mailer_use_client_cert | ternary('true', 'false') }} {% if gitea_mailer_use_client_cert | bool %} -CLIENT_CERT_FILE = {{ gitea_mailer_client_cert_file }} -CLIENT_KEY_FILE = {{ gitea_mailer_client_key_file }} +CLIENT_CERT_FILE = {{ gitea_mailer_client_cert_file }} +CLIENT_KEY_FILE = {{ gitea_mailer_client_key_file }} {% endif %} FORCE_TRUST_SERVER_CERT = {{ gitea_mailer_force_trust_server_cert | ternary('true', 'false') }} -USER = {{ gitea_mailer_user }} -PASSWD = `{{ gitea_mailer_password }}` -ENABLE_HELO = {{ gitea_mailer_enable_helo | ternary('true', 'false') }} -FROM = {{ gitea_mailer_from }} -SUBJECT_PREFIX = {{ gitea_subject_prefix }} -SEND_AS_PLAIN_TEXT = {{ gitea_mailer_send_as_plaintext | ternary('true', 'false') }} +USER = {{ gitea_mailer_user }} +PASSWD = `{{ gitea_mailer_password }}` +ENABLE_HELO = {{ gitea_mailer_enable_helo | ternary('true', 'false') }} +FROM = {{ gitea_mailer_from }} +SUBJECT_PREFIX = {{ gitea_subject_prefix }} +SEND_AS_PLAIN_TEXT = {{ gitea_mailer_send_as_plaintext | ternary('true', 'false') }} {{ gitea_mailer_extra_config }} ; {% endif %} @@ -218,7 +218,7 @@ SEND_AS_PLAIN_TEXT = {{ gitea_mailer_send_as_plaintext | ternary('true', 'f ; ; -> https://docs.gitea.io/en-us/config-cheat-sheet/#session-session [session] -PROVIDER = {{ gitea_session_provider }} +PROVIDER = {{ gitea_session_provider }} PROVIDER_CONFIG = {{ gitea_home }}/data/sessions {{ gitea_session_extra_config }} ; @@ -231,42 +231,42 @@ AVATAR_UPLOAD_PATH = {{ gitea_home }}/data/avatars ; ; -> https://docs.gitea.io/en-us/config-cheat-sheet/#issue-and-pull-request-attachments-attachment [attachment] -ENABLED = {{ gitea_attachment_enabled | ternary('true', 'false') }} -ALLOWED_TYPES = {{ gitea_attachment_types }} -MAX_SIZE = {{ gitea_attachment_max_size }} -PATH = {{ gitea_home }}/data/attachments +ENABLED = {{ gitea_attachment_enabled | ternary('true', 'false') }} +ALLOWED_TYPES = {{ gitea_attachment_types }} +MAX_SIZE = {{ gitea_attachment_max_size }} +PATH = {{ gitea_home }}/data/attachments {{ gitea_attachment_extra_config }} ; ; ; -> https://docs.gitea.io/en-us/config-cheat-sheet/#log-log [log] -ROOT_PATH = {{ gitea_home }}/log +ROOT_PATH = {{ gitea_home }}/log {% if gitea_log_systemd %} -MODE = console +MODE = console {% else %} -MODE = file +MODE = file {% endif %} -LEVEL = {{ gitea_log_level }} +LEVEL = {{ gitea_log_level }} {{ gitea_log_extra_config }} ; ; ; -> https://docs.gitea.io/en-us/config-cheat-sheet/#metrics-metrics [metrics] ENABLED = {{ gitea_metrics_enabled | ternary('true', 'false') }} -TOKEN = {{ gitea_metrics_token }} +TOKEN = {{ gitea_metrics_token }} {{ gitea_metrics_extra }} ; ; ; -> https://docs.gitea.io/en-us/config-cheat-sheet/#oauth2-oauth2 [oauth2] -ENABLE = {{ gitea_oauth2_enabled | ternary('true', 'false') }} +ENABLE = {{ gitea_oauth2_enabled | ternary('true', 'false') }} JWT_SECRET = {{ gitea_oauth2_jwt_secret }} {{ gitea_oauth2_extra_config }} ; ; ; -> https://docs.gitea.io/en-us/config-cheat-sheet/#federation-federation [federation] -ENABLED = {{ gitea_federation_enabled | ternary('true', 'false') }} +ENABLED = {{ gitea_federation_enabled | ternary('true', 'false') }} SHARE_USER_STATISTICS = {{ gitea_federation_share_user_stats | ternary('true', 'false') }} {{ gitea_federation_extra }} ; @@ -274,7 +274,7 @@ SHARE_USER_STATISTICS = {{ gitea_federation_share_user_stats | ternary('true', ' ; Packages (packages) ; -> https://docs.gitea.io/en-us/config-cheat-sheet/#packages-packages [packages] -ENABLED = {{ gitea_packages_enabled | ternary('true', 'false') }} +ENABLED = {{ gitea_packages_enabled | ternary('true', 'false') }} {% if gitea_packages_enabled | bool %} CHUNKED_UPLOAD_PATH = {{ gitea_home }}/data/tmp/package-upload {{ gitea_packages_extra }} @@ -284,9 +284,9 @@ CHUNKED_UPLOAD_PATH = {{ gitea_home }}/data/tmp/package-upload {% if gitea_lfs_server_enabled | bool %} ; -> https://docs.gitea.io/en-us/config-cheat-sheet/#lfs-lfs [lfs] -STORAGE_TYPE = {{ gitea_lfs_storage_type }} -SERVE_DIRECT = {{ gitea_lfs_serve_direct | ternary('true', 'false') }} -PATH = {{ gitea_lfs_content_path }} +STORAGE_TYPE = {{ gitea_lfs_storage_type }} +SERVE_DIRECT = {{ gitea_lfs_serve_direct | ternary('true', 'false') }} +PATH = {{ gitea_lfs_content_path }} {{ gitea_lfs_extra }} {% endif %} ; @@ -294,7 +294,7 @@ PATH = {{ gitea_lfs_content_path }} {% if gitea_actions_enabled | bool %} ; -> https://docs.gitea.io/en-us/config-cheat-sheet/#actions-actions [actions] -ENABLED = {{ gitea_actions_enabled }} +ENABLED = {{ gitea_actions_enabled }} DEFAULT_ACTIONS_URL = {{ gitea_actions_default_actions_url }} {{ gitea_actions_extra }} {% endif %} @@ -303,10 +303,10 @@ DEFAULT_ACTIONS_URL = {{ gitea_actions_default_actions_url }} ; Other (other) ; -> https://docs.gitea.io/en-us/config-cheat-sheet/#other-other [other] -SHOW_FOOTER_VERSION = {{ gitea_other_show_footer_version | ternary('true', 'false') }} +SHOW_FOOTER_VERSION = {{ gitea_other_show_footer_version | ternary('true', 'false') }} SHOW_FOOTER_TEMPLATE_LOAD_TIME = {{ gitea_other_show_footer_template_load_time | ternary('true', 'false') }} -ENABLE_SITEMAP = {{ gitea_other_enable_sitemap | ternary('true', 'false') }} -ENABLE_FEED = {{ gitea_other_enable_feed | ternary('true', 'false') }} +ENABLE_SITEMAP = {{ gitea_other_enable_sitemap | ternary('true', 'false') }} +ENABLE_FEED = {{ gitea_other_enable_feed | ternary('true', 'false') }} ; ; ; From 2912ec874fcd1ad2f2853cd5e6819efe214e8abe Mon Sep 17 00:00:00 2001 From: Lyn Matten Date: Tue, 29 Aug 2023 09:35:35 +0200 Subject: [PATCH 03/31] removed double parameter entries; added missing variable gitea_show_milestones_dashboard; fixed ini layout to only show valid changed when using -D --- defaults/main.yml | 6 +- templates/gitea.ini.j2 | 127 ++++++++++++++++++++--------------------- 2 files changed, 64 insertions(+), 69 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index ef25d10..16a01dd 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -162,20 +162,18 @@ gitea_enable_captcha: true gitea_show_registration_button: true gitea_only_allow_external_registration: false gitea_enable_notify_mail: false -gitea_auto_watch_new_repos: true gitea_service_extra_config: '' -gitea_autowatch_new_repo: false +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_email_confirm: false gitea_register_manual_confirm: true gitea_default_allow_create_organization: false gitea_default_user_is_restricted: true gitea_email_domain_allowlist: "" -gitea_auto_watch_new_repos: false 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: "" # Mailer [mailer] diff --git a/templates/gitea.ini.j2 b/templates/gitea.ini.j2 index 9009e5d..6409b7f 100644 --- a/templates/gitea.ini.j2 +++ b/templates/gitea.ini.j2 @@ -1,16 +1,17 @@ ; this file is the configuration of your local gitea instance ; {{ ansible_managed }} -; +; ; This file overwrites the default values from gitea. ; undefined variables will use the default value from gitea. ; Cheat Sheet: https://docs.gitea.io/en-us/config-cheat-sheet/ -; +; ; -> https://docs.gitea.io/en-us/config-cheat-sheet/#overall-default APP_NAME = {{ gitea_app_name }} RUN_USER = {{ gitea_user }} RUN_MODE = {{ gitea_run_mode }} -; -; +WORK_PATH = {{ gitea_home }} +; +; ; -> https://docs.gitea.io/en-us/config-cheat-sheet/#repository-repository [repository] ROOT = {{ gitea_repository_root }} @@ -25,16 +26,16 @@ DEFAULT_REPO_UNITS = {{ gitea_default_repo_units }} DISABLE_STARS = {{ gitea_disable_stars | ternary('true', 'false') }} DEFAULT_BRANCH = {{ gitea_default_branch }} {{ gitea_repository_extra_config }} -; -; +; +; ; -> https://docs.gitea.io/en-us/administration/config-cheat-sheet/#repository---upload-repositoryupload [repository.upload] ENABLED = {{ gitea_repository_upload_enabled | ternary('true', 'false') }} TEMP_PATH = {{ gitea_home }}/data/tmp/uploads FILE_MAX_SIZE = {{ gitea_repository_upload_max_size }} {{ gitea_repository_upload_extra_config }} -; -; +; +; {% if gitea_enable_repo_signing_options | bool %} ; -> https://docs.gitea.io/en-us/config-cheat-sheet/#repository---signing-repositorysigning [repository.signing] @@ -47,11 +48,11 @@ WIKI = {{ gitea_repo_wiki }} CRUD_ACTIONS = {{ gitea_repo_crud_actions }} MERGES = {{ gitea_repo_merges }} {{ gitea_enable_repo_signing_extra }} -; +; {% endif %} -; +; {% if gitea_enable_cors | bool %} -; +; ; -> https://docs.gitea.io/en-us/config-cheat-sheet/#cors-cors [cors] ENABLED = {{ gitea_enable_cors | ternary('true', 'false') }} @@ -64,25 +65,25 @@ ALLOW_CREDENTIALS = {{ gitea_cors_allow_credentials | ternary('true', 'false') } HEADERS = {{ gitea_cors_headers }} X_FRAME_OPTIONS = {{ gitea_cors_x_frame_options }} {{ gitea_cors_extra }} -; +; {% endif %} -; +; ; -> https://docs.gitea.io/en-us/config-cheat-sheet/#ui-ui [ui] THEMES = {{ gitea_themes }} DEFAULT_THEME = {{ gitea_theme_default }} -SHOW_USER_EMAIL= {{ gitea_show_user_email | ternary('true', 'false') }} +SHOW_USER_EMAIL = {{ gitea_show_user_email | ternary('true', 'false') }} {{ gitea_ui_extra_config }} -; -; -; +; +; +; [ui.meta] AUTHOR = {{ gitea_ui_author }} DESCRIPTION = {{ gitea_ui_description }} KEYWORDS = {{ gitea_ui_keywords }} {{ gitea_ui_meta_extra_config }} -; -; +; +; ; -> https://docs.gitea.io/en-us/config-cheat-sheet/#server-server [server] APP_DATA_PATH = {{ gitea_home }}/data @@ -118,8 +119,8 @@ ACME_EMAIL = {{ gitea_acme_email }} ACME_CA_ROOT = {{ gitea_acme_ca_root }} {% endif %} {{ gitea_server_extra_config }} -; -; +; +; ; -> https://docs.gitea.io/en-us/config-cheat-sheet/#database-database [database] DB_TYPE = {{ gitea_db_type }} @@ -131,8 +132,8 @@ SSL_MODE = {{ gitea_db_ssl }} PATH = {{ gitea_db_path }} LOG_SQL = {{ gitea_db_log_sql | ternary('true', 'false') }} {{ gitea_database_extra_config }} -; -; +; +; ; -> https://docs.gitea.io/en-us/config-cheat-sheet/#indexer-indexer [indexer] ISSUE_INDEXER_PATH = {{ gitea_home }}/indexers/issues.bleve @@ -143,15 +144,15 @@ REPO_INDEXER_EXCLUDE = {{ gitea_repo_indexer_exclude }} REPO_INDEXER_EXCLUDE_VENDORED = {{ gitea_repo_exclude_vendored | ternary('true', 'false') }} MAX_FILE_SIZE = {{ gitea_repo_indexer_max_file_size }} {{ gitea_indexer_extra_config }} -; -; +; +; ; Queue (queue and queue.*) ; -> https://docs.gitea.io/en-us/config-cheat-sheet/#queue-queue-and-queue [queue.issue_indexer] DATADIR = {{ gitea_home }}/indexers/issues.queue {{ gitea_queue_issue_indexer_extra_config }} -; -; +; +; ; -> https://docs.gitea.io/en-us/config-cheat-sheet/#security-security [security] INSTALL_LOCK = true @@ -161,8 +162,8 @@ DISABLE_WEBHOOKS = {{ gitea_disable_webhooks | ternary('true', 'false') }} INTERNAL_TOKEN = {{ gitea_internal_token }} PASSWORD_CHECK_PWN = {{ gitea_password_check_pwn | ternary('true', 'false') }} {{ gitea_security_extra_config }} -; -; +; +; ; -> https://docs.gitea.io/en-us/config-cheat-sheet/#service-service [service] REGISTER_EMAIL_CONFIRM = {{ gitea_register_email_confirm | ternary('true', 'false') }} @@ -174,24 +175,20 @@ 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') }} -; new -AUTO_WATCH_NEW_REPOS = {{ gitea_autowatch_new_repo }} -AUTO_WATCH_ON_CHANGES = {{ gitea_autowatch_on_change }} +AUTO_WATCH_ON_CHANGES = {{ gitea_autowatch_on_change }} SHOW_MILESTONES_DASHBOARD_PAGE = {{ gitea_show_mailstones_dashboard }} -REGISTER_EMAIL_CONFIRM = {{ gitea_register_email_confirm }} 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 %} EMAIL_DOMAIN_ALLOWLIST = {{ gitea_email_domain_allowlist }} {% endif %} -AUTO_WATCH_NEW_REPOS = {{ gitea_auto_watch_new_repos }} DEFAULT_USER_VISIBILITY = {{ gitea_default_user_visibility }} DEFAULT_ORG_VISIBILITY = {{ gitea_default_org_visibility }} ALLOW_ONLY_INTERNAL_REGISTRATION = {{ gitea_allow_only_internal_registration }} {{ gitea_service_extra_config }} -; -; +; +; ; -> https://docs.gitea.io/en-us/config-cheat-sheet/#mailer-mailer [mailer] ENABLED = {{ gitea_mailer_enabled | ternary('true', 'false') }} @@ -206,29 +203,29 @@ CLIENT_KEY_FILE = {{ gitea_mailer_client_key_file }} {% endif %} FORCE_TRUST_SERVER_CERT = {{ gitea_mailer_force_trust_server_cert | ternary('true', 'false') }} USER = {{ gitea_mailer_user }} -PASSWD = `{{ gitea_mailer_password }}` +PASSWD = {{ gitea_mailer_password }} ENABLE_HELO = {{ gitea_mailer_enable_helo | ternary('true', 'false') }} -FROM = {{ gitea_mailer_from }} +FROM = {{ gitea_mailer_from }} SUBJECT_PREFIX = {{ gitea_subject_prefix }} SEND_AS_PLAIN_TEXT = {{ gitea_mailer_send_as_plaintext | ternary('true', 'false') }} {{ gitea_mailer_extra_config }} -; +; {% endif %} -; -; +; +; ; -> https://docs.gitea.io/en-us/config-cheat-sheet/#session-session [session] PROVIDER = {{ gitea_session_provider }} PROVIDER_CONFIG = {{ gitea_home }}/data/sessions {{ gitea_session_extra_config }} -; -; +; +; ; -> https://docs.gitea.io/en-us/config-cheat-sheet/#picture-picture [picture] AVATAR_UPLOAD_PATH = {{ gitea_home }}/data/avatars {{ gitea_picture_extra_config }} -; -; +; +; ; -> https://docs.gitea.io/en-us/config-cheat-sheet/#issue-and-pull-request-attachments-attachment [attachment] ENABLED = {{ gitea_attachment_enabled | ternary('true', 'false') }} @@ -236,8 +233,8 @@ ALLOWED_TYPES = {{ gitea_attachment_types }} MAX_SIZE = {{ gitea_attachment_max_size }} PATH = {{ gitea_home }}/data/attachments {{ gitea_attachment_extra_config }} -; -; +; +; ; -> https://docs.gitea.io/en-us/config-cheat-sheet/#log-log [log] ROOT_PATH = {{ gitea_home }}/log @@ -248,29 +245,29 @@ MODE = file {% endif %} LEVEL = {{ gitea_log_level }} {{ gitea_log_extra_config }} -; -; +; +; ; -> https://docs.gitea.io/en-us/config-cheat-sheet/#metrics-metrics [metrics] ENABLED = {{ gitea_metrics_enabled | ternary('true', 'false') }} TOKEN = {{ gitea_metrics_token }} {{ gitea_metrics_extra }} -; -; +; +; ; -> https://docs.gitea.io/en-us/config-cheat-sheet/#oauth2-oauth2 [oauth2] ENABLE = {{ gitea_oauth2_enabled | ternary('true', 'false') }} JWT_SECRET = {{ gitea_oauth2_jwt_secret }} {{ gitea_oauth2_extra_config }} -; -; +; +; ; -> https://docs.gitea.io/en-us/config-cheat-sheet/#federation-federation [federation] ENABLED = {{ gitea_federation_enabled | ternary('true', 'false') }} SHARE_USER_STATISTICS = {{ gitea_federation_share_user_stats | ternary('true', 'false') }} {{ gitea_federation_extra }} -; -; +; +; ; Packages (packages) ; -> https://docs.gitea.io/en-us/config-cheat-sheet/#packages-packages [packages] @@ -279,8 +276,8 @@ ENABLED = {{ gitea_packages_enabled | ternary('true', 'false') }} CHUNKED_UPLOAD_PATH = {{ gitea_home }}/data/tmp/package-upload {{ gitea_packages_extra }} {% endif %} -; -; +; +; {% if gitea_lfs_server_enabled | bool %} ; -> https://docs.gitea.io/en-us/config-cheat-sheet/#lfs-lfs [lfs] @@ -289,8 +286,8 @@ SERVE_DIRECT = {{ gitea_lfs_serve_direct | ternary('true', 'false') }} PATH = {{ gitea_lfs_content_path }} {{ gitea_lfs_extra }} {% endif %} -; -; +; +; {% if gitea_actions_enabled | bool %} ; -> https://docs.gitea.io/en-us/config-cheat-sheet/#actions-actions [actions] @@ -298,8 +295,8 @@ ENABLED = {{ gitea_actions_enabled }} DEFAULT_ACTIONS_URL = {{ gitea_actions_default_actions_url }} {{ gitea_actions_extra }} {% endif %} -; -; +; +; ; Other (other) ; -> https://docs.gitea.io/en-us/config-cheat-sheet/#other-other [other] @@ -307,8 +304,8 @@ SHOW_FOOTER_VERSION = {{ gitea_other_show_footer_version | ternary('true', 'fals SHOW_FOOTER_TEMPLATE_LOAD_TIME = {{ gitea_other_show_footer_template_load_time | ternary('true', 'false') }} ENABLE_SITEMAP = {{ gitea_other_enable_sitemap | ternary('true', 'false') }} ENABLE_FEED = {{ gitea_other_enable_feed | ternary('true', 'false') }} -; -; -; +; +; +; ; Optional additional config -{{ gitea_extra_config }} +{{ gitea_extra_config }} \ No newline at end of file From 9a306158c2df590a41547463acbe24aeae084b3a Mon Sep 17 00:00:00 2001 From: L3D Date: Wed, 30 Aug 2023 01:08:02 +0200 Subject: [PATCH 04/31] 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' From afe1705cf03f3e12c441313c25e2ad9a0cfd570c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 5 Sep 2023 05:54:06 +0000 Subject: [PATCH 05/31] Bump actions/checkout from 3 to 4 Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v3...v4) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/ansible-linting-check.yml | 2 +- .github/workflows/galaxy.yml | 2 +- .github/workflows/yamllint.yaml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ansible-linting-check.yml b/.github/workflows/ansible-linting-check.yml index 5c55ca6..0b1268c 100644 --- a/.github/workflows/ansible-linting-check.yml +++ b/.github/workflows/ansible-linting-check.yml @@ -11,7 +11,7 @@ jobs: steps: - name: 'checkout git repo' - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: lfs: true submodules: false diff --git a/.github/workflows/galaxy.yml b/.github/workflows/galaxy.yml index 39fa2be..4426496 100644 --- a/.github/workflows/galaxy.yml +++ b/.github/workflows/galaxy.yml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-latest steps: - name: 'checkout git repo' - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: 'release on galaxy' uses: robertdebock/galaxy-action@1.2.1 diff --git a/.github/workflows/yamllint.yaml b/.github/workflows/yamllint.yaml index 361b111..99bb4c4 100644 --- a/.github/workflows/yamllint.yaml +++ b/.github/workflows/yamllint.yaml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest steps: - name: 'checkout git repo' - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: 'Yamllint' uses: karancode/yamllint-github-action@v2.1.1 From 66399c05ba6f926a6bea875a9e3ea678c2443f69 Mon Sep 17 00:00:00 2001 From: Jan-Piet Mens Date: Sun, 10 Sep 2023 15:21:36 +0200 Subject: [PATCH 06/31] fix two small typos in task names --- tasks/install_forgejo.yml | 2 +- tasks/install_gitea.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tasks/install_forgejo.yml b/tasks/install_forgejo.yml index 31a4801..c4b5a05 100644 --- a/tasks/install_forgejo.yml +++ b/tasks/install_forgejo.yml @@ -54,7 +54,7 @@ become: false failed_when: _gitea_gpg_key_status.rc not in (0, 2) - - name: Print gpg key staus on verbosity + - name: Print gpg key status on verbosity ansible.builtin.debug: msg: "{{ _gitea_gpg_key_status.stdout }}" verbosity: 1 diff --git a/tasks/install_gitea.yml b/tasks/install_gitea.yml index 4f88b8f..78c603b 100644 --- a/tasks/install_gitea.yml +++ b/tasks/install_gitea.yml @@ -53,7 +53,7 @@ changed_when: false failed_when: _gitea_gpg_key_status.rc not in (0, 2) - - name: Print gpg key staus on verbosity + - name: Print gpg key status on verbosity ansible.builtin.debug: msg: "{{ _gitea_gpg_key_status.stdout }}" verbosity: 1 From 9409bbb61a4854df8629216dcc0b997a09571f8a Mon Sep 17 00:00:00 2001 From: Andreas Brain Date: Fri, 15 Sep 2023 16:01:32 +0200 Subject: [PATCH 07/31] Remove ternary filter from non-boolean variable --- templates/gitea.ini.j2 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/gitea.ini.j2 b/templates/gitea.ini.j2 index e7be89c..af6c505 100644 --- a/templates/gitea.ini.j2 +++ b/templates/gitea.ini.j2 @@ -183,8 +183,8 @@ DEFAULT_USER_IS_RESTRICTED = {{ gitea_default_user_is_restricted | ternary('true {% 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 | ternary('true', 'false') }} -DEFAULT_ORG_VISIBILITY = {{ gitea_default_org_visibility | ternary('true', 'false') }} +DEFAULT_USER_VISIBILITY = {{ gitea_default_user_visibility }} +DEFAULT_ORG_VISIBILITY = {{ gitea_default_org_visibility }} 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 }} From fe0e8f707c0b7e4f3dc6a9c530556181080e85b2 Mon Sep 17 00:00:00 2001 From: L3D Date: Tue, 10 Oct 2023 19:21:55 +0200 Subject: [PATCH 08/31] Apply new UI Address --- README.md | 54 +++++++++++++++++++++++++++--------------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index 1b69432..fa6928b 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ The following code has been tested with the latest Debian Stable, it should work 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](https://docs.gitea.io/en-us/config-cheat-sheet/). +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](https://docs.gitea.com/administration/config-cheat-sheet). ### Chose between gitea and forgejo There is a fork of gitea called forgejo. Why? Read the [forgejo FAQ](https://forgejo.org/faq/). @@ -71,7 +71,7 @@ Either you define exactly which release you install. Or you use the option ``lat | `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 | -### Overall ([DEFAULT](https://docs.gitea.io/en-us/config-cheat-sheet/#overall-default)) +### Overall ([DEFAULT](https://docs.gitea.com/administration/config-cheat-sheet#overall-default)) | variable name | default value | description | | ------------- | ------------- | ----------- | | `gitea_app_name` | `Gitea` | Displayed application name | @@ -79,7 +79,7 @@ Either you define exactly which release you install. Or you use the option ``lat | `gitea_run_mode`| `prod`| Application run mode, affects performance and debugging. Either “dev”, “prod” or “test”. | | `gitea_fqdn` | `localhost` | Base FQDN for the installation, used as default for other variables. Set it to the FQDN where you can reach your gitea server | -### Repository ([repository](https://docs.gitea.io/en-us/config-cheat-sheet/#repository-repository)) +### Repository ([repository](https://docs.gitea.com/administration/config-cheat-sheet#repository-repository)) | variable name | default value | description | | ------------- | ------------- | ----------- | | `gitea_default_branch` | `main` | Default branch name of all repositories. | @@ -95,14 +95,14 @@ Either you define exactly which release you install. Or you use the option ``lat | `gitea_repository_root` | `{{ gitea_home }}/repos` | Root path for storing all repository data. It must be an absolute path. | | `gitea_repository_extra_config` | | you can use this variable to pass additional config parameters in the `[repository]` section of the config. | -### Repository - Upload ([repository.upload](https://docs.gitea.io/en-us/administration/config-cheat-sheet/#repository---upload-repositoryupload)) +### Repository - Upload ([repository.upload](https://docs.gitea.io/en-us/administration/config-cheat-sheet#repository---upload-repositoryupload)) | variable name | default value | description | | ------------- | ------------- | ----------- | | `gitea_repository_upload_enabled` | `true` | Whether repository file uploads are enabled | | `gitea_repository_upload_max_size` | `4` | Max size of each file in megabytes. | | `gitea_repository_upload_extra_config` | | you can use this variable to pass additional config parameters in the `[repository.upload]` section of the config. | -### Repository - Signing ([repository.signing](https://docs.gitea.io/en-us/config-cheat-sheet/#repository---signing-repositorysigning)) +### Repository - Signing ([repository.signing](https://docs.gitea.com/administration/config-cheat-sheet#repository---signing-repositorysigning)) | variable name | default value | description | | ------------- | ------------- | ----------- | | `gitea_enable_repo_signing_options` | `false` | Allow to configure repo signing options | @@ -116,7 +116,7 @@ Either you define exactly which release you install. Or you use the option ``lat | `gitea_repo_merges` | *(see defaults)* | Sign merges. | | `gitea_enable_repo_signing_extra` | | you can use this variable to pass additional config parameters in the `[repository.signing]` section of the config. | -### CORS ([cors](https://docs.gitea.io/en-us/config-cheat-sheet/#cors-cors)) +### CORS ([cors](https://docs.gitea.com/administration/config-cheat-sheet#cors-cors)) | variable name | default value | description | | ------------- | ------------- | ----------- | | `gitea_enable_cors` | `false` | enable cors headers (disabled by default) | @@ -130,7 +130,7 @@ Either you define exactly which release you install. Or you use the option ``lat | `gitea_cors_x_frame_options` | `SAMEORIGIN` | Set the `X-Frame-Options` header value. | | `gitea_cors_extra` | | you can use this variable to pass additional config parameters in the `[cors]` section of the config. | -### UI ([ui](https://docs.gitea.io/en-us/config-cheat-sheet/#ui-ui)) +### UI ([ui](https://docs.gitea.com/administration/config-cheat-sheet#ui-ui)) | variable name | default value | description | | ------------- | ------------- | ----------- | | `gitea_show_user_email` | `false` | Do you want to display email addresses ? (true/false) | @@ -138,7 +138,7 @@ Either you define exactly which release you install. Or you use the option ``lat | `gitea_themes` | `auto,gitea,arc-green` | List of enabled themes | | `gitea_ui_extra_config` | | you can use this variable to pass additional config parameters in the `[ui]` section of the config. | -### UI - Meta ([ui.meta](https://docs.gitea.io/en-us/config-cheat-sheet/#ui---metadata-uimeta)) +### UI - Meta ([ui.meta](https://docs.gitea.com/administration/config-cheat-sheet#ui---metadata-uimeta)) | variable name | default value | description | | ------------- | ------------- | ----------- | | `gitea_ui_author` | *(see defaults)* | Author meta tag of the homepage. | @@ -146,7 +146,7 @@ Either you define exactly which release you install. Or you use the option ``lat | `gitea_ui_keywords` | *(see defaults)* | Keywords meta tag of the homepage | | `gitea_ui_meta_extra_config` | | you can use this variable to pass additional config parameters in the `[ui.meta]` section of the config. | -### Server ([server](https://docs.gitea.io/en-us/config-cheat-sheet/#server-server)) +### Server ([server](https://docs.gitea.com/administration/config-cheat-sheet#server-server)) | variable name | default value | description | | ------------- | ------------- | ----------- | | `gitea_protocol`| `http` | Listening protocol [http, https, fcgi, unix, fcgi+unix] | @@ -175,7 +175,7 @@ Either you define exactly which release you install. Or you use the option ``lat | `gitea_acme_ca_root` | | The CA’s root certificate. If left empty, it defaults to using the system’s trust chain. | | `gitea_server_extra_config` | | you can use this variable to pass additional config parameters in the `[server]` section of the config. | -### Database ([database](https://docs.gitea.io/en-us/config-cheat-sheet/#database-database)) +### Database ([database](https://docs.gitea.com/administration/config-cheat-sheet#database-database)) | variable name | default value | description | | ------------- | ------------- | ----------- | | `gitea_db_type` | `sqlite3` | The database type in use `[mysql, postgres, mssql, sqlite3]`. | @@ -183,12 +183,12 @@ Either you define exactly which release you install. Or you use the option ``lat | `gitea_db_name` | `root` | Database name | | `gitea_db_user` | `gitea` | Database username | | `gitea_db_password` | `lel` | Database password. **PLEASE CHANGE** | -| `gitea_db_ssl` | `disable` | Configure SSL only if your database type supports it. Have a look into the [config-cheat-sheet](https://docs.gitea.io/en-us/config-cheat-sheet/#database-database) for more detailed information | +| `gitea_db_ssl` | `disable` | Configure SSL only if your database type supports it. Have a look into the [config-cheat-sheet](https://docs.gitea.com/administration/config-cheat-sheet#database-database) for more detailed information | | `gitea_db_path` | `{{ gitea_home }}/data/gitea.db` | DB path, if you use `sqlite3`. | | `gitea_db_log_sql` | `false` | Log the executed SQL. | | `gitea_database_extra_config` | | you can use this variable to pass additional config parameters in the `[database]` section of the config. | -### Indexer ([indexer](https://docs.gitea.io/en-us/config-cheat-sheet/#indexer-indexer)) +### Indexer ([indexer](https://docs.gitea.com/administration/config-cheat-sheet#indexer-indexer)) | variable name | default value | description | | ------------- | ------------- | ----------- | | `gitea_repo_indexer_enabled` | `false` | Enables code search *(uses a lot of disk space, about 6 times more than the repository size).* | @@ -199,7 +199,7 @@ Either you define exactly which release you install. Or you use the option ``lat | `gitea_indexer_extra_config` | | you can use this variable to pass additional config parameters in the `[indexer]` section of the config. | | `gitea_queue_issue_indexer_extra_config` | | | you can use this variable to pass additional config parameters in the `[queue.issue_indexer]` section of the config. | -### Security ([security](https://docs.gitea.io/en-us/config-cheat-sheet/#security-security)) +### Security ([security](https://docs.gitea.com/administration/config-cheat-sheet#security-security)) | variable name | default value | description | | ------------- | ------------- | ----------- | | `gitea_secret_key` | | Global secret key. Will be autogenerated if not defined. Should be unique. | @@ -209,7 +209,7 @@ Either you define exactly which release you install. Or you use the option ``lat | `gitea_password_check_pwn` | `false` | Check [HaveIBeenPwned](https://haveibeenpwned.com/Passwords) to see if a password has been exposed. | | `gitea_security_extra_config` | | you can use this variable to pass additional config parameters in the `[security]` section of the config. | -### Service ([service](https://docs.gitea.io/en-us/config-cheat-sheet/#service-service)) +### Service ([service](https://docs.gitea.com/administration/config-cheat-sheet#service-service)) | variable name | default value | description | | ------------- | ------------- | ----------- | | `gitea_disable_registration` | `false` | Do you want to disable user registration? (true/false) | @@ -233,7 +233,7 @@ Either you define exactly which release you install. Or you use the option ``lat | `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)) +### Mailer ([mailer](https://docs.gitea.com/administration/config-cheat-sheet#mailer-mailer)) | variable name | default value | description | | ------------- | ------------- | ----------- | | `gitea_mailer_enabled` | `false` | Whether to enable the mailer. | @@ -252,18 +252,18 @@ Either you define exactly which release you install. Or you use the option ``lat | `gitea_mailer_send_as_plaintext` | `false` | Send mails only in plain text, without HTML alternative. | | `gitea_mailer_extra_config` | | you can use this variable to pass additional config parameters in the `[mailer]` section of the config. | -### Session ([session](https://docs.gitea.io/en-us/config-cheat-sheet/#session-session)) +### Session ([session](https://docs.gitea.com/administration/config-cheat-sheet#session-session)) | variable name | default value | description | | ------------- | ------------- | ----------- | | `gitea_session_provider` | `file` | Session engine provider | | `gitea_session_extra_config` | | you can use this variable to pass additional config parameters in the `[session]` section of the config. | -### Picture ([picture](https://docs.gitea.io/en-us/config-cheat-sheet/#picture-picture)) +### Picture ([picture](https://docs.gitea.com/administration/config-cheat-sheet#picture-picture)) | variable name | default value | description | | ------------- | ------------- | ----------- | | `gitea_picture_extra_config` | | you can use this variable to pass additional config parameters in the `[picture]` section of the config. | -### Issue and pull request attachments ([attachment](https://docs.gitea.io/en-us/config-cheat-sheet/#issue-and-pull-request-attachments-attachment)) +### Issue and pull request attachments ([attachment](https://docs.gitea.com/administration/config-cheat-sheet#issue-and-pull-request-attachments-attachment)) | variable name | default value | description | | ------------- | ------------- | ----------- | | `attachment_enabled` | `true` | Whether issue and pull request attachments are enabled. | @@ -271,41 +271,41 @@ Either you define exactly which release you install. Or you use the option ``lat | `gitea_attachment_max_size` | `4` | Maximum size (MB). | | `gitea_attachment_extra_config` | | you can use this variable to pass additional config parameters in the `[attachment]` section of the config. | -### Log ([log](https://docs.gitea.io/en-us/config-cheat-sheet/#log-log)) +### Log ([log](https://docs.gitea.com/administration/config-cheat-sheet#log-log)) | variable name | default value | description | | ------------- | ------------- | ----------- | | `gitea_log_systemd` | `false` | Disable logging into `file`, use systemd-journald | | `gitea_log_level` | `Warn` | General log level. `[Trace, Debug, Info, Warn, Error, Critical, Fatal, None]` | | `gitea_log_extra_config` | | you can use this variable to pass additional config parameters in the `[log]` section of the config. | -### Metrics ([metrics](https://docs.gitea.io/en-us/config-cheat-sheet/#metrics-metrics)) +### Metrics ([metrics](https://docs.gitea.com/administration/config-cheat-sheet#metrics-metrics)) | variable name | default value | description | | ------------- | ------------- | ----------- | | `gitea_metrics_enabled`| `false` | Enable the metrics endpoint | | `gitea_metrics_token`| | Bearer token for the Prometheus scrape job | | `gitea_metrics_extra` | | you can use this variable to pass additional config parameters in the `[metrics]` section of the config. | -### OAuth2 ([oauth2](https://docs.gitea.io/en-us/config-cheat-sheet/#oauth2-oauth2)) +### OAuth2 ([oauth2](https://docs.gitea.com/administration/config-cheat-sheet#oauth2-oauth2)) | variable name | default value | description | | ------------- | ------------- | ----------- | | `gitea_oauth2_enabled` | `true` | Enable the Oauth2 provider (true/false) | | `gitea_oauth2_jwt_secret` | | 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. | -### Federation ([federation](https://docs.gitea.io/en-us/config-cheat-sheet/#federation-federation)) +### Federation ([federation](https://docs.gitea.com/administration/config-cheat-sheet#federation-federation)) | variable name | default value | description | | ------------- | ------------- | ----------- | | `gitea_federation_enabled` | `false` | Enable/Disable federation capabilities | | `gitea_federation_share_user_stats` | `false` | Enable/Disable user statistics for nodeinfo if federation is enabled | | `gitea_federation_extra` | | you can use this variable to pass additional config parameters in the `[federation]` section of the config. | -### Packages ([packages](https://docs.gitea.io/en-us/config-cheat-sheet/#packages-packages)) +### Packages ([packages](https://docs.gitea.com/administration/config-cheat-sheet#packages-packages)) | variable name | default value | description | | ------------- | ------------- | ----------- | | `gitea_packages_enabled` | `true` | Enable/Disable package registry capabilities | | `gitea_packages_extra` | |you can use this variable to pass additional config parameters in the `[packages]` section of the config. | -### LFS ([lfs](https://docs.gitea.io/en-us/config-cheat-sheet/#lfs-lfs)) +### LFS ([lfs](https://docs.gitea.com/administration/config-cheat-sheet#lfs-lfs)) | variable name | default value | description | | ------------- | ------------- | ----------- | | `gitea_lfs_storage_type` | `local` | Storage type for lfs | @@ -313,14 +313,14 @@ Either you define exactly which release you install. Or you use the option ``lat | `gitea_lfs_content_path` | `{{ gitea_home }}/data/lfs` | Where to store LFS files | | `gitea_lfs_extra` | | you can use this variable to pass additional config parameters in the `[lfs]` section of the config. | -### Actions ([actions](https://docs.gitea.io/en-us/config-cheat-sheet/#actions-actions)) +### Actions ([actions](https://docs.gitea.com/administration/config-cheat-sheet#actions-actions)) | variable name | default value | description | | ------------- | ------------- | ----------- | | `gitea_actions_enabled` | `false` | Enable/Disable actions capabilities globaly. You may want to add `repo.actions` to `gitea_default_repo_units` to enable actions on all new repositories | | `gitea_actions_default_actions_url` | `https://gitea.com/` | Default address to get action plugins, e.g. the default value means downloading from `https://gitea.com/actions/checkout` for `uses: actions/checkout@v3` | | `gitea_actions_extra` | | you can use this variable to pass additional config parameters in the `[actions]` section of the config. | -### Other ([other](https://docs.gitea.io/en-us/config-cheat-sheet/#other-other)) +### Other ([other](https://docs.gitea.com/administration/config-cheat-sheet#other-other)) | variable name | default value | description | | ------------- | ------------- | ----------- | | `gitea_other_show_footer_version` | `true` | Show Gitea and Go version information in the footer. | @@ -331,7 +331,7 @@ Either you define exactly which release you install. Or you use the option ``lat ### additional gitea config | variable name | default value | description | | ------------- | ------------- | ----------- | -| `gitea_extra_config` | | Additional gitea configuration. Have a look at the [config-cheat-sheet](https://docs.gitea.io/en-us/config-cheat-sheet/) before using it! | +| `gitea_extra_config` | | Additional gitea configuration. Have a look at the [config-cheat-sheet](https://docs.gitea.com/administration/config-cheat-sheet) before using it! | ### Fail2Ban configuration From dc5d8c60ee6abd08c8ab136fd3b9e158d0c78856 Mon Sep 17 00:00:00 2001 From: L3D Date: Tue, 10 Oct 2023 19:30:38 +0200 Subject: [PATCH 09/31] Cleanup whitespace and change linter --- .github/galaxy.svg | 85 ----------- .github/license.svg | 60 -------- .github/workflows/ansible-linting-check.yml | 8 +- templates/gitea.ini.j2 | 156 ++++++++++---------- vars/main.yml | 2 +- 5 files changed, 83 insertions(+), 228 deletions(-) delete mode 100644 .github/galaxy.svg delete mode 100644 .github/license.svg diff --git a/.github/galaxy.svg b/.github/galaxy.svg deleted file mode 100644 index 5e5c1f3..0000000 --- a/.github/galaxy.svg +++ /dev/null @@ -1,85 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/.github/license.svg b/.github/license.svg deleted file mode 100644 index c711475..0000000 --- a/.github/license.svg +++ /dev/null @@ -1,60 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/.github/workflows/ansible-linting-check.yml b/.github/workflows/ansible-linting-check.yml index 0b1268c..81008bf 100644 --- a/.github/workflows/ansible-linting-check.yml +++ b/.github/workflows/ansible-linting-check.yml @@ -11,13 +11,13 @@ jobs: steps: - name: 'checkout git repo' - uses: actions/checkout@v4 + uses: actions/checkout@v4.1.0 with: lfs: true submodules: false fetch-depth: 0 - - name: 'Lint Ansible Playbook' - uses: ansible/ansible-lint-action@v6 + - name: Run ansible-lint + uses: ansible-actions/ansible-lint-action@v0.0.2 with: - path: "." + target: "./" diff --git a/templates/gitea.ini.j2 b/templates/gitea.ini.j2 index e7be89c..15ba1f8 100644 --- a/templates/gitea.ini.j2 +++ b/templates/gitea.ini.j2 @@ -1,18 +1,18 @@ ; this file is the configuration of your local gitea instance ; {{ ansible_managed }} -; +; ; This file overwrites the default values from gitea. ; undefined variables will use the default value from gitea. -; Cheat Sheet: https://docs.gitea.io/en-us/config-cheat-sheet/ -; -; -> https://docs.gitea.io/en-us/config-cheat-sheet/#overall-default +; Cheat Sheet: https://docs.gitea.com/next/administration/config-cheat-sheet/ +; +; -> https://docs.gitea.com/next/administration/config-cheat-sheet#overall-default APP_NAME = {{ gitea_app_name }} RUN_USER = {{ gitea_user }} RUN_MODE = {{ gitea_run_mode }} WORK_PATH = {{ gitea_home }} -; -; -; -> https://docs.gitea.io/en-us/config-cheat-sheet/#repository-repository +; +; +; -> https://docs.gitea.com/next/administration/config-cheat-sheet/#repository-repository [repository] ROOT = {{ gitea_repository_root }} FORCE_PRIVATE = {{ gitea_force_private | ternary('true', 'false') }} @@ -26,18 +26,18 @@ DEFAULT_REPO_UNITS = {{ gitea_default_repo_units }} DISABLE_STARS = {{ gitea_disable_stars | ternary('true', 'false') }} DEFAULT_BRANCH = {{ gitea_default_branch }} {{ gitea_repository_extra_config }} -; -; -; -> https://docs.gitea.io/en-us/administration/config-cheat-sheet/#repository---upload-repositoryupload +; +; +; -> https://docs.gitea.com/next/administration/administration/config-cheat-sheet/#repository---upload-repositoryupload [repository.upload] ENABLED = {{ gitea_repository_upload_enabled | ternary('true', 'false') }} TEMP_PATH = {{ gitea_home }}/data/tmp/uploads FILE_MAX_SIZE = {{ gitea_repository_upload_max_size }} {{ gitea_repository_upload_extra_config }} -; -; +; +; {% if gitea_enable_repo_signing_options | bool %} -; -> https://docs.gitea.io/en-us/config-cheat-sheet/#repository---signing-repositorysigning +; -> https://docs.gitea.com/next/administration/config-cheat-sheet/#repository---signing-repositorysigning [repository.signing] SIGNING_KEY = {{ gitea_repo_signing_key }} SIGNING_NAME = {{ gitea_repo_signing_name }} @@ -48,12 +48,12 @@ WIKI = {{ gitea_repo_wiki }} CRUD_ACTIONS = {{ gitea_repo_crud_actions }} MERGES = {{ gitea_repo_merges }} {{ gitea_enable_repo_signing_extra }} -; +; {% endif %} -; +; {% if gitea_enable_cors | bool %} -; -; -> https://docs.gitea.io/en-us/config-cheat-sheet/#cors-cors +; +; -> https://docs.gitea.com/next/administration/config-cheat-sheet/#cors-cors [cors] ENABLED = {{ gitea_enable_cors | ternary('true', 'false') }} SCHEME = {{ gitea_cors_scheme }} @@ -65,26 +65,26 @@ ALLOW_CREDENTIALS = {{ gitea_cors_allow_credentials | ternary('true', 'false') } HEADERS = {{ gitea_cors_headers }} X_FRAME_OPTIONS = {{ gitea_cors_x_frame_options }} {{ gitea_cors_extra }} -; +; {% endif %} -; -; -> https://docs.gitea.io/en-us/config-cheat-sheet/#ui-ui +; +; -> https://docs.gitea.com/next/administration/config-cheat-sheet/#ui-ui [ui] THEMES = {{ gitea_themes }} DEFAULT_THEME = {{ gitea_theme_default }} SHOW_USER_EMAIL = {{ gitea_show_user_email | ternary('true', 'false') }} {{ gitea_ui_extra_config }} -; -; -; +; +; +; [ui.meta] AUTHOR = {{ gitea_ui_author }} DESCRIPTION = {{ gitea_ui_description }} KEYWORDS = {{ gitea_ui_keywords }} {{ gitea_ui_meta_extra_config }} -; -; -; -> https://docs.gitea.io/en-us/config-cheat-sheet/#server-server +; +; +; -> https://docs.gitea.com/next/administration/config-cheat-sheet/#server-server [server] APP_DATA_PATH = {{ gitea_home }}/data PROTOCOL = {{ gitea_protocol }} @@ -119,9 +119,9 @@ ACME_EMAIL = {{ gitea_acme_email }} ACME_CA_ROOT = {{ gitea_acme_ca_root }} {% endif %} {{ gitea_server_extra_config }} -; -; -; -> https://docs.gitea.io/en-us/config-cheat-sheet/#database-database +; +; +; -> https://docs.gitea.com/next/administration/config-cheat-sheet/#database-database [database] DB_TYPE = {{ gitea_db_type }} HOST = {{ gitea_db_host }} @@ -132,9 +132,9 @@ SSL_MODE = {{ gitea_db_ssl }} PATH = {{ gitea_db_path }} LOG_SQL = {{ gitea_db_log_sql | ternary('true', 'false') }} {{ gitea_database_extra_config }} -; -; -; -> https://docs.gitea.io/en-us/config-cheat-sheet/#indexer-indexer +; +; +; -> https://docs.gitea.com/next/administration/config-cheat-sheet/#indexer-indexer [indexer] ISSUE_INDEXER_PATH = {{ gitea_home }}/indexers/issues.bleve REPO_INDEXER_ENABLED = {{ gitea_repo_indexer_enabled | ternary('true', 'false') }} @@ -144,16 +144,16 @@ REPO_INDEXER_EXCLUDE = {{ gitea_repo_indexer_exclude }} REPO_INDEXER_EXCLUDE_VENDORED = {{ gitea_repo_exclude_vendored | ternary('true', 'false') }} MAX_FILE_SIZE = {{ gitea_repo_indexer_max_file_size }} {{ gitea_indexer_extra_config }} -; -; +; +; ; Queue (queue and queue.*) -; -> https://docs.gitea.io/en-us/config-cheat-sheet/#queue-queue-and-queue +; -> https://docs.gitea.com/next/administration/config-cheat-sheet/#queue-queue-and-queue [queue.issue_indexer] DATADIR = {{ gitea_home }}/indexers/issues.queue {{ gitea_queue_issue_indexer_extra_config }} -; -; -; -> https://docs.gitea.io/en-us/config-cheat-sheet/#security-security +; +; +; -> https://docs.gitea.com/next/administration/config-cheat-sheet/#security-security [security] INSTALL_LOCK = true SECRET_KEY = {{ gitea_secret_key }} @@ -162,9 +162,9 @@ DISABLE_WEBHOOKS = {{ gitea_disable_webhooks | ternary('true', 'false') }} INTERNAL_TOKEN = {{ gitea_internal_token }} PASSWORD_CHECK_PWN = {{ gitea_password_check_pwn | ternary('true', 'false') }} {{ gitea_security_extra_config }} -; -; -; -> https://docs.gitea.io/en-us/config-cheat-sheet/#service-service +; +; +; -> https://docs.gitea.com/next/administration/config-cheat-sheet/#service-service [service] REGISTER_EMAIL_CONFIRM = {{ gitea_register_email_confirm | ternary('true', 'false') }} DISABLE_REGISTRATION = {{ gitea_disable_registration | ternary('true', 'false') }} @@ -188,9 +188,9 @@ DEFAULT_ORG_VISIBILITY = {{ gitea_default_org_visibility | ternary('true', 'fals 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 }} -; -; -; -> https://docs.gitea.io/en-us/config-cheat-sheet/#mailer-mailer +; +; +; -> https://docs.gitea.com/next/administration/config-cheat-sheet/#mailer-mailer [mailer] ENABLED = {{ gitea_mailer_enabled | ternary('true', 'false') }} {% if gitea_mailer_enabled | bool %} @@ -210,33 +210,33 @@ FROM = {{ gitea_mailer_from }} SUBJECT_PREFIX = {{ gitea_subject_prefix }} SEND_AS_PLAIN_TEXT = {{ gitea_mailer_send_as_plaintext | ternary('true', 'false') }} {{ gitea_mailer_extra_config }} -; +; {% endif %} -; -; -; -> https://docs.gitea.io/en-us/config-cheat-sheet/#session-session +; +; +; -> https://docs.gitea.com/next/administration/config-cheat-sheet/#session-session [session] PROVIDER = {{ gitea_session_provider }} PROVIDER_CONFIG = {{ gitea_home }}/data/sessions {{ gitea_session_extra_config }} -; -; -; -> https://docs.gitea.io/en-us/config-cheat-sheet/#picture-picture +; +; +; -> https://docs.gitea.com/next/administration/config-cheat-sheet/#picture-picture [picture] AVATAR_UPLOAD_PATH = {{ gitea_home }}/data/avatars {{ gitea_picture_extra_config }} -; -; -; -> https://docs.gitea.io/en-us/config-cheat-sheet/#issue-and-pull-request-attachments-attachment +; +; +; -> https://docs.gitea.com/next/administration/config-cheat-sheet/#issue-and-pull-request-attachments-attachment [attachment] ENABLED = {{ gitea_attachment_enabled | ternary('true', 'false') }} ALLOWED_TYPES = {{ gitea_attachment_types }} MAX_SIZE = {{ gitea_attachment_max_size }} PATH = {{ gitea_home }}/data/attachments {{ gitea_attachment_extra_config }} -; -; -; -> https://docs.gitea.io/en-us/config-cheat-sheet/#log-log +; +; +; -> https://docs.gitea.com/next/administration/config-cheat-sheet/#log-log [log] ROOT_PATH = {{ gitea_home }}/log {% if gitea_log_systemd %} @@ -246,60 +246,60 @@ MODE = file {% endif %} LEVEL = {{ gitea_log_level }} {{ gitea_log_extra_config }} -; -; -; -> https://docs.gitea.io/en-us/config-cheat-sheet/#metrics-metrics +; +; +; -> https://docs.gitea.com/next/administration/config-cheat-sheet/#metrics-metrics [metrics] ENABLED = {{ gitea_metrics_enabled | ternary('true', 'false') }} TOKEN = {{ gitea_metrics_token }} {{ gitea_metrics_extra }} -; -; -; -> https://docs.gitea.io/en-us/config-cheat-sheet/#oauth2-oauth2 +; +; +; -> https://docs.gitea.com/next/administration/config-cheat-sheet/#oauth2-oauth2 [oauth2] ENABLE = {{ gitea_oauth2_enabled | ternary('true', 'false') }} JWT_SECRET = {{ gitea_oauth2_jwt_secret }} {{ gitea_oauth2_extra_config }} -; -; -; -> https://docs.gitea.io/en-us/config-cheat-sheet/#federation-federation +; +; +; -> https://docs.gitea.com/next/administration/config-cheat-sheet/#federation-federation [federation] ENABLED = {{ gitea_federation_enabled | ternary('true', 'false') }} SHARE_USER_STATISTICS = {{ gitea_federation_share_user_stats | ternary('true', 'false') }} {{ gitea_federation_extra }} -; -; +; +; ; Packages (packages) -; -> https://docs.gitea.io/en-us/config-cheat-sheet/#packages-packages +; -> https://docs.gitea.com/next/administration/config-cheat-sheet/#packages-packages [packages] ENABLED = {{ gitea_packages_enabled | ternary('true', 'false') }} {% if gitea_packages_enabled | bool %} CHUNKED_UPLOAD_PATH = {{ gitea_home }}/data/tmp/package-upload {{ gitea_packages_extra }} {% endif %} -; -; +; +; {% if gitea_lfs_server_enabled | bool %} -; -> https://docs.gitea.io/en-us/config-cheat-sheet/#lfs-lfs +; -> https://docs.gitea.com/next/administration/config-cheat-sheet/#lfs-lfs [lfs] STORAGE_TYPE = {{ gitea_lfs_storage_type }} SERVE_DIRECT = {{ gitea_lfs_serve_direct | ternary('true', 'false') }} PATH = {{ gitea_lfs_content_path }} {{ gitea_lfs_extra }} {% endif %} -; -; +; +; {% if gitea_actions_enabled | bool %} -; -> https://docs.gitea.io/en-us/config-cheat-sheet/#actions-actions +; -> https://docs.gitea.com/next/administration/config-cheat-sheet/#actions-actions [actions] ENABLED = {{ gitea_actions_enabled }} DEFAULT_ACTIONS_URL = {{ gitea_actions_default_actions_url }} {{ gitea_actions_extra }} {% endif %} -; -; +; +; ; Other (other) -; -> https://docs.gitea.io/en-us/config-cheat-sheet/#other-other +; -> https://docs.gitea.com/next/administration/config-cheat-sheet/#other-other [other] SHOW_FOOTER_VERSION = {{ gitea_other_show_footer_version | ternary('true', 'false') }} SHOW_FOOTER_TEMPLATE_LOAD_TIME = {{ gitea_other_show_footer_template_load_time | ternary('true', 'false') }} diff --git a/vars/main.yml b/vars/main.yml index 87f226a..d6abe74 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: 50 # should be int +playbook_version_number: 51 # should be int playbook_version_path: 'do1jlr.gitea.version' From dddf75a6989a8f830b64eca4e1d3c4313d60cadd Mon Sep 17 00:00:00 2001 From: L3D Date: Tue, 10 Oct 2023 19:48:14 +0200 Subject: [PATCH 10/31] Update ansible-linting-check.yml Signed-off-by: L3D --- .github/workflows/ansible-linting-check.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ansible-linting-check.yml b/.github/workflows/ansible-linting-check.yml index 81008bf..9ad66de 100644 --- a/.github/workflows/ansible-linting-check.yml +++ b/.github/workflows/ansible-linting-check.yml @@ -18,6 +18,7 @@ jobs: fetch-depth: 0 - name: Run ansible-lint - uses: ansible-actions/ansible-lint-action@v0.0.2 + uses: ansible-actions/ansible-lint-action@v0.0.3 with: target: "./" + python_dependency: "jmespath" From 38599ae607e9ac29dcd5d54fa1efd408cba90017 Mon Sep 17 00:00:00 2001 From: L3D Date: Sat, 21 Oct 2023 02:16:13 +0200 Subject: [PATCH 11/31] andding jinja2 linter and improve template + update yamllint + update ansible-lint + add j2lint + lint j2 template --- .github/workflows/ansible-linting-check.yml | 9 ++++--- .github/workflows/j2lint-check.yml | 22 ++++++++++++++++ .github/workflows/yamllint-check.yml | 22 ++++++++++++++++ README.md | 9 +++---- requirements.yml | 4 +++ templates/gitea.ini.j2 | 28 ++++++++++----------- vars/main.yml | 2 +- 7 files changed, 72 insertions(+), 24 deletions(-) create mode 100644 .github/workflows/j2lint-check.yml create mode 100644 .github/workflows/yamllint-check.yml create mode 100644 requirements.yml diff --git a/.github/workflows/ansible-linting-check.yml b/.github/workflows/ansible-linting-check.yml index 9ad66de..949c09a 100644 --- a/.github/workflows/ansible-linting-check.yml +++ b/.github/workflows/ansible-linting-check.yml @@ -11,14 +11,15 @@ jobs: steps: - name: 'checkout git repo' - uses: actions/checkout@v4.1.0 + uses: actions/checkout@v4.1.1 with: lfs: true - submodules: false + submodules: true fetch-depth: 0 - name: Run ansible-lint - uses: ansible-actions/ansible-lint-action@v0.0.3 + uses: ansible-actions/ansible-lint-action@v1.0.1 with: target: "./" - python_dependency: "jmespath" + collections_yml: 'requirements.yml' + python_dependency: 'jmespath' diff --git a/.github/workflows/j2lint-check.yml b/.github/workflows/j2lint-check.yml new file mode 100644 index 0000000..5037de5 --- /dev/null +++ b/.github/workflows/j2lint-check.yml @@ -0,0 +1,22 @@ +--- +name: Jinja2 Linting check + +# yamllint disable-line rule:truthy +on: [push, pull_request] + +jobs: + build: + name: Jinja2 Linting + runs-on: ubuntu-latest + + steps: + - name: 'checkout git repo' + uses: actions/checkout@v4 + with: + submodules: true + fetch-depth: 0 + + - name: Run j2lint + uses: ansible-actions/j2lint-action@v0.0.1 + with: + target: "./" diff --git a/.github/workflows/yamllint-check.yml b/.github/workflows/yamllint-check.yml new file mode 100644 index 0000000..751e992 --- /dev/null +++ b/.github/workflows/yamllint-check.yml @@ -0,0 +1,22 @@ +--- +name: Yamllint check + +# yamllint disable-line rule:truthy +on: [push, pull_request] + +jobs: + build: + name: Yamllint + runs-on: ubuntu-latest + + steps: + - name: 'checkout git repo' + uses: actions/checkout@v4 + with: + submodules: true + fetch-depth: 0 + + - name: Run yamllint + uses: ansible-actions/yamllint-action@v0.0.1 + with: + target: "./" diff --git a/README.md b/README.md index fa6928b..f1df09c 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![Ansible Galaxy](https://ansible.l3d.space/svg/l3d.gitea.svg)](https://galaxy.ansible.com/l3d/gitea) +[![Ansible Galaxy](https://ansible.l3d.space/svg/l3d.gitea.svg)](https://galaxy.ansible.com/ui/standalone/roles/l3d/gitea/) [![BSD-3 Clause](https://ansible.l3d.space/svg/l3d.gitea_license.svg)](LICENSE) [![Maintainance](https://ansible.l3d.space/svg/l3d.gitea_maintainance.svg)](https://ansible.l3d.space/#l3d.gitea) @@ -15,7 +15,7 @@ This role is also Part of the Ansible-Collection [l3d.git](https://galaxy.ansibl The following code has been tested with the latest Debian Stable, it should work on Ubuntu and RedHat as well. ```yaml -# ansible-galaxy install l3d.gitea +# ansible-galaxy role install l3d.gitea - name: "Install gitea" hosts: git.example.com @@ -385,11 +385,10 @@ This role uses the ``ansible.builtin`` and ``community.general`` ansible Collect ### Galaxy Collections + community.general - ### Example requirements Installation ``` -ansible-galaxy install community.general -pip3 install jmespath +ansible-galaxy collection install --update --role-file requirements.yml +pip3 install --update jmespath ``` ## Contribute diff --git a/requirements.yml b/requirements.yml new file mode 100644 index 0000000..2159e44 --- /dev/null +++ b/requirements.yml @@ -0,0 +1,4 @@ +--- +collections: + - name: community.general + source: https://galaxy.ansible.com diff --git a/templates/gitea.ini.j2 b/templates/gitea.ini.j2 index 705a1f7..e4bea98 100644 --- a/templates/gitea.ini.j2 +++ b/templates/gitea.ini.j2 @@ -1,8 +1,8 @@ -; this file is the configuration of your local gitea instance +; this file is the configuration of your local Gitea instance ; {{ ansible_managed }} ; -; This file overwrites the default values from gitea. -; undefined variables will use the default value from gitea. +; This file overwrites the default values from Gitea. +; undefined variables will use the default value from Gitea. ; Cheat Sheet: https://docs.gitea.com/next/administration/config-cheat-sheet/ ; ; -> https://docs.gitea.com/next/administration/config-cheat-sheet#overall-default @@ -90,7 +90,7 @@ APP_DATA_PATH = {{ gitea_home }}/data PROTOCOL = {{ gitea_protocol }} DOMAIN = {{ gitea_http_domain }} ROOT_URL = {{ gitea_root_url }} -HTTP_ADDR = {{ gitea_http_listen }} +HTTP_ADDR = {{ gitea_http_listen }} HTTP_PORT = {{ gitea_http_port }} START_SSH_SERVER = {{ gitea_start_ssh | ternary('true', 'false') }} SSH_DOMAIN = {{ gitea_ssh_domain }} @@ -102,7 +102,7 @@ CERT_FILE = {{ gitea_tls_cert_file }} KEY_FILE = {{ gitea_tls_key_file }} {% endif %} LANDING_PAGE = {{ gitea_landing_page }} -{% if gitea_lfs_server_enabled | bool -%} +{% if gitea_lfs_server_enabled | bool %} LFS_START_SERVER = true LFS_JWT_SECRET = {{ gitea_lfs_jwt_secret }} {% endif %} @@ -110,9 +110,9 @@ REDIRECT_OTHER_PORT = {{ gitea_redirect_other_port | ternary('true', 'false') }} PORT_TO_REDIRECT = {{ gitea_port_to_redirect }} ENABLE_ACME = {{ gitea_enable_acme | ternary('true', 'false') }} {% if gitea_enable_acme | bool %} -{% if gitea_acme_url != '' %} +{% if gitea_acme_url != '' %} ACME_URL = {{ gitea_acme_url }} -{% endif %} +{% endif %} ACME_ACCEPTTOS = {{ gitea_acme_accepttos | ternary('true', 'false') }} ACME_DIRECTORY = {{ gitea_acme_directory }} ACME_EMAIL = {{ gitea_acme_email }} @@ -194,14 +194,14 @@ ALLOW_ONLY_EXTERNAL_REGISTRATION = {{ gitea_allow_only_external_registration | t [mailer] ENABLED = {{ gitea_mailer_enabled | ternary('true', 'false') }} {% if gitea_mailer_enabled | bool %} +{% if gitea_mailer_use_client_cert | bool %} +CLIENT_CERT_FILE = {{ gitea_mailer_client_cert_file }} +CLIENT_KEY_FILE = {{ gitea_mailer_client_key_file }} +{% endif %} PROTOCOL = {{ gitea_mailer_protocol }} SMTP_ADDR = {{ gitea_mailer_smtp_addr }} SMTP_PORT = {{ gitea_mailer_smtp_port }} USE_CLIENT_CERT = {{ gitea_mailer_use_client_cert | ternary('true', 'false') }} -{% if gitea_mailer_use_client_cert | bool %} -CLIENT_CERT_FILE = {{ gitea_mailer_client_cert_file }} -CLIENT_KEY_FILE = {{ gitea_mailer_client_key_file }} -{% endif %} FORCE_TRUST_SERVER_CERT = {{ gitea_mailer_force_trust_server_cert | ternary('true', 'false') }} USER = {{ gitea_mailer_user }} PASSWD = {{ gitea_mailer_password }} @@ -305,8 +305,8 @@ SHOW_FOOTER_VERSION = {{ gitea_other_show_footer_version | ternary('true', 'fals SHOW_FOOTER_TEMPLATE_LOAD_TIME = {{ gitea_other_show_footer_template_load_time | ternary('true', 'false') }} ENABLE_SITEMAP = {{ gitea_other_enable_sitemap | ternary('true', 'false') }} ENABLE_FEED = {{ gitea_other_enable_feed | ternary('true', 'false') }} -; -; -; +; +; +; ; Optional additional config {{ gitea_extra_config }} diff --git a/vars/main.yml b/vars/main.yml index d6abe74..ba8f195 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: 51 # should be int +playbook_version_number: 52 # should be int playbook_version_path: 'do1jlr.gitea.version' From aa749c5faf9a77c03ea11c325640ef4d5db39d28 Mon Sep 17 00:00:00 2001 From: L3D Date: Sat, 21 Oct 2023 02:18:56 +0200 Subject: [PATCH 12/31] only push releases to galaxy --- .github/workflows/galaxy.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/galaxy.yml b/.github/workflows/galaxy.yml index 4426496..0b12f52 100644 --- a/.github/workflows/galaxy.yml +++ b/.github/workflows/galaxy.yml @@ -3,8 +3,6 @@ name: Galaxy release # yamllint disable-line rule:truthy on: - push: - branches: ['main'] release: types: ['created'] From 78b2e2f2272021c9d661e1cf8026554cd479c1b4 Mon Sep 17 00:00:00 2001 From: L3D Date: Sun, 22 Oct 2023 19:42:57 +0200 Subject: [PATCH 13/31] Update Actions --- .github/workflows/ansible-linting-check.yml | 2 -- .github/workflows/galaxy.yml | 20 +++++++++++------- .github/workflows/yamllint.yaml | 23 --------------------- 3 files changed, 12 insertions(+), 33 deletions(-) delete mode 100644 .github/workflows/yamllint.yaml diff --git a/.github/workflows/ansible-linting-check.yml b/.github/workflows/ansible-linting-check.yml index 949c09a..006a20e 100644 --- a/.github/workflows/ansible-linting-check.yml +++ b/.github/workflows/ansible-linting-check.yml @@ -13,8 +13,6 @@ jobs: - name: 'checkout git repo' uses: actions/checkout@v4.1.1 with: - lfs: true - submodules: true fetch-depth: 0 - name: Run ansible-lint diff --git a/.github/workflows/galaxy.yml b/.github/workflows/galaxy.yml index 0b12f52..d099de3 100644 --- a/.github/workflows/galaxy.yml +++ b/.github/workflows/galaxy.yml @@ -1,5 +1,5 @@ --- -name: Galaxy release +name: Galaxy-NG Roles Import # yamllint disable-line rule:truthy on: @@ -8,13 +8,17 @@ on: jobs: build: + name: Galaxy Role Importer runs-on: ubuntu-latest - steps: - - name: 'checkout git repo' - uses: actions/checkout@v4 - - name: 'release on galaxy' - uses: robertdebock/galaxy-action@1.2.1 + steps: + - name: 'Checkout git repo' + uses: actions/checkout@v4 with: - galaxy_api_key: ${{ secrets.galaxy_api_key }} - git_branch: 'main' + submodules: true + fetch-depth: 0 + + - name: 'Release on galaxy' + uses: ansible-actions/ansible-galaxy-action@v1.0.0 + with: + galaxy_api_key: ${{ secrets.galaxy_api_key } diff --git a/.github/workflows/yamllint.yaml b/.github/workflows/yamllint.yaml deleted file mode 100644 index 99bb4c4..0000000 --- a/.github/workflows/yamllint.yaml +++ /dev/null @@ -1,23 +0,0 @@ ---- -name: 'Yamllint GitHub Actions' - -# yamllint disable-line rule:truthy -on: - push: - branches: '*' - pull_request: - branches: '*' - -jobs: - yamllint: - name: 'Yamllint' - runs-on: ubuntu-latest - steps: - - name: 'checkout git repo' - uses: actions/checkout@v4 - - - name: 'Yamllint' - uses: karancode/yamllint-github-action@v2.1.1 - with: - yamllint_file_or_dir: '.' - yamllint_config_filepath: './.yamllint' From 0d060d2d653cc9f9b9083700045b7707e6889da9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 23 Oct 2023 05:57:19 +0000 Subject: [PATCH 14/31] Bump ansible-actions/ansible-galaxy-action from 1.0.0 to 1.0.1 Bumps [ansible-actions/ansible-galaxy-action](https://github.com/ansible-actions/ansible-galaxy-action) from 1.0.0 to 1.0.1. - [Release notes](https://github.com/ansible-actions/ansible-galaxy-action/releases) - [Commits](https://github.com/ansible-actions/ansible-galaxy-action/compare/v1.0.0...v1.0.1) --- updated-dependencies: - dependency-name: ansible-actions/ansible-galaxy-action dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .github/workflows/galaxy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/galaxy.yml b/.github/workflows/galaxy.yml index d099de3..e4fd223 100644 --- a/.github/workflows/galaxy.yml +++ b/.github/workflows/galaxy.yml @@ -19,6 +19,6 @@ jobs: fetch-depth: 0 - name: 'Release on galaxy' - uses: ansible-actions/ansible-galaxy-action@v1.0.0 + uses: ansible-actions/ansible-galaxy-action@v1.0.1 with: galaxy_api_key: ${{ secrets.galaxy_api_key } From 036bf11e00f85f330b66635d22a54fb99c7f4b92 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 23 Oct 2023 05:57:22 +0000 Subject: [PATCH 15/31] Bump ansible-actions/ansible-lint-action from 1.0.1 to 1.0.2 Bumps [ansible-actions/ansible-lint-action](https://github.com/ansible-actions/ansible-lint-action) from 1.0.1 to 1.0.2. - [Release notes](https://github.com/ansible-actions/ansible-lint-action/releases) - [Commits](https://github.com/ansible-actions/ansible-lint-action/compare/v1.0.1...v1.0.2) --- updated-dependencies: - dependency-name: ansible-actions/ansible-lint-action dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .github/workflows/ansible-linting-check.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ansible-linting-check.yml b/.github/workflows/ansible-linting-check.yml index 006a20e..09587b6 100644 --- a/.github/workflows/ansible-linting-check.yml +++ b/.github/workflows/ansible-linting-check.yml @@ -16,7 +16,7 @@ jobs: fetch-depth: 0 - name: Run ansible-lint - uses: ansible-actions/ansible-lint-action@v1.0.1 + uses: ansible-actions/ansible-lint-action@v1.0.2 with: target: "./" collections_yml: 'requirements.yml' From dec676bfd9d88403348c7e11d49401d9f133a651 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 27 Oct 2023 05:47:59 +0000 Subject: [PATCH 16/31] Bump ansible-actions/ansible-galaxy-action from 1.0.1 to 1.1.1 Bumps [ansible-actions/ansible-galaxy-action](https://github.com/ansible-actions/ansible-galaxy-action) from 1.0.1 to 1.1.1. - [Release notes](https://github.com/ansible-actions/ansible-galaxy-action/releases) - [Commits](https://github.com/ansible-actions/ansible-galaxy-action/compare/v1.0.1...v1.1.1) --- updated-dependencies: - dependency-name: ansible-actions/ansible-galaxy-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .github/workflows/galaxy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/galaxy.yml b/.github/workflows/galaxy.yml index e4fd223..ebfc532 100644 --- a/.github/workflows/galaxy.yml +++ b/.github/workflows/galaxy.yml @@ -19,6 +19,6 @@ jobs: fetch-depth: 0 - name: 'Release on galaxy' - uses: ansible-actions/ansible-galaxy-action@v1.0.1 + uses: ansible-actions/ansible-galaxy-action@v1.1.1 with: galaxy_api_key: ${{ secrets.galaxy_api_key } From db3c5e99f07637d28fbf7122590ef534e0fb46e9 Mon Sep 17 00:00:00 2001 From: L3D Date: Sun, 29 Oct 2023 16:11:12 +0100 Subject: [PATCH 17/31] Improve linting and cleanup --- requirements.yml | 4 +-- tasks/backup.yml | 18 +++++----- tasks/customize_footer.yml | 4 +-- tasks/customize_logo.yml | 10 +++--- tasks/customize_public_files.yml | 4 +-- tasks/directory.yml | 2 +- tasks/fail2ban.yml | 2 +- tasks/install_forgejo.yml | 2 +- tasks/install_gitea.yml | 2 +- tasks/main.yml | 58 ++++++++++++++++++++------------ tasks/set_forgejo_version.yml | 6 ++-- tasks/versioncheck.yml | 7 ++-- 12 files changed, 66 insertions(+), 53 deletions(-) diff --git a/requirements.yml b/requirements.yml index 2159e44..a5a1e10 100644 --- a/requirements.yml +++ b/requirements.yml @@ -1,4 +1,4 @@ --- collections: - - name: community.general - source: https://galaxy.ansible.com + - name: 'community.general' + version: ">=7.5.0,<=8.0.0" diff --git a/tasks/backup.yml b/tasks/backup.yml index 3dc9074..6a9fc56 100644 --- a/tasks/backup.yml +++ b/tasks/backup.yml @@ -11,20 +11,18 @@ - name: Stopping gitea before upgrade become: true ansible.builtin.systemd: - name: gitea - state: stopped + name: 'gitea.service' + state: 'stopped' when: ansible_service_mgr == "systemd" - name: "Create backup directory" become: true ansible.builtin.file: - path: "{{ item }}" - state: directory + path: "{{ gitea_backup_location }}" + state: 'directory' owner: "{{ gitea_user }}" group: "{{ gitea_group }}" mode: 'u=rwx,g=rx,o=' - with_items: - - "{{ gitea_backup_location }}" - name: Backing up gitea before upgrade become: true @@ -36,10 +34,10 @@ - name: Starting gitea because backup failed become: true ansible.builtin.systemd: - name: gitea - state: stopped + name: 'gitea.service' + state: 'started' when: ansible_service_mgr == "systemd" - - name: Print updateing error - ansible.builtin.debug: + - name: Print updateing error and cancel + ansible.builtin.fail: msg: "failed to backup gitea" diff --git a/tasks/customize_footer.yml b/tasks/customize_footer.yml index f7f8931..1f14080 100644 --- a/tasks/customize_footer.yml +++ b/tasks/customize_footer.yml @@ -7,7 +7,7 @@ owner: "{{ gitea_user }}" group: "{{ gitea_group }}" mode: 'u=rwX,g=rX,o=' - with_items: + loop: - "{{ gitea_custom }}/templates" - "{{ gitea_custom }}/templates/custom" @@ -19,6 +19,6 @@ owner: "{{ gitea_user }}" group: "{{ gitea_group }}" mode: '0644' - ignore_errors: true + failed_when: false tags: skip_ansible_lint notify: "Restart gitea" diff --git a/tasks/customize_logo.yml b/tasks/customize_logo.yml index 4d4d609..c3e8ae7 100644 --- a/tasks/customize_logo.yml +++ b/tasks/customize_logo.yml @@ -7,7 +7,7 @@ owner: "{{ gitea_user }}" group: "{{ gitea_group }}" mode: 'u=rwX,g=rX,o=' - with_items: + loop: - "{{ gitea_custom }}/public" - "{{ gitea_custom }}/public/img" @@ -20,7 +20,7 @@ group: "{{ gitea_group }}" mode: '0644' tags: skip_ansible_lint - ignore_errors: true + failed_when: false - name: Transfer custom logo.png become: true @@ -31,7 +31,7 @@ group: "{{ gitea_group }}" mode: '0644' tags: skip_ansible_lint - ignore_errors: true + failed_when: false - name: Transfer custom favicon.png become: true @@ -42,7 +42,7 @@ group: "{{ gitea_group }}" mode: '0644' tags: skip_ansible_lint - ignore_errors: true + failed_when: false - name: Transfer custom apple-touch-icon.png become: true @@ -53,4 +53,4 @@ group: "{{ gitea_group }}" mode: '0644' tags: skip_ansible_lint - ignore_errors: true + failed_when: false diff --git a/tasks/customize_public_files.yml b/tasks/customize_public_files.yml index 9c14c9a..747a103 100644 --- a/tasks/customize_public_files.yml +++ b/tasks/customize_public_files.yml @@ -7,7 +7,7 @@ owner: "{{ gitea_user }}" group: "{{ gitea_group }}" mode: 'u=rwX,g=rX,o=' - with_items: + loop: - "{{ gitea_custom }}/public" - name: Transfer custom public web data @@ -19,6 +19,6 @@ group: "{{ gitea_group }}" directory_mode: true mode: 'u=rwX,g=rX,o=' - ignore_errors: true + failed_when: false tags: skip_ansible_lint notify: "Restart gitea" diff --git a/tasks/directory.yml b/tasks/directory.yml index 2a9e2aa..5154b40 100644 --- a/tasks/directory.yml +++ b/tasks/directory.yml @@ -7,7 +7,7 @@ owner: "{{ gitea_user }}" group: "{{ gitea_group }}" mode: 'u=rwX,g=rX,o=' - with_items: + loop: - "{{ gitea_configuration_path }}" - "{{ gitea_user_home }}" - "{{ gitea_home }}" diff --git a/tasks/fail2ban.yml b/tasks/fail2ban.yml index aa41bde..af439e3 100644 --- a/tasks/fail2ban.yml +++ b/tasks/fail2ban.yml @@ -25,5 +25,5 @@ ansible.builtin.fail: msg: "the package fail2ban is not installed. no fail2ban filters deployed." when: "'fail2ban' not in ansible_facts.packages" - ignore_errors: true + failed_when: false tags: skip_ansible_lint_ignore-errors diff --git a/tasks/install_forgejo.yml b/tasks/install_forgejo.yml index c4b5a05..6cbb79e 100644 --- a/tasks/install_forgejo.yml +++ b/tasks/install_forgejo.yml @@ -54,7 +54,7 @@ become: false failed_when: _gitea_gpg_key_status.rc not in (0, 2) - - name: Print gpg key status on verbosity + - name: Print gpg key status on verbosity # noqa: H500 ansible.builtin.debug: msg: "{{ _gitea_gpg_key_status.stdout }}" verbosity: 1 diff --git a/tasks/install_gitea.yml b/tasks/install_gitea.yml index 78c603b..4a7f5c4 100644 --- a/tasks/install_gitea.yml +++ b/tasks/install_gitea.yml @@ -53,7 +53,7 @@ changed_when: false failed_when: _gitea_gpg_key_status.rc not in (0, 2) - - name: Print gpg key status on verbosity + - name: Print gpg key status on verbosity # noqa: H500 ansible.builtin.debug: msg: "{{ _gitea_gpg_key_status.stdout }}" verbosity: 1 diff --git a/tasks/main.yml b/tasks/main.yml index 7fe7331..c1862f4 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,65 +1,81 @@ --- - name: Perform optional versionscheck - ansible.builtin.include_tasks: versioncheck.yml + ansible.builtin.include_tasks: + file: 'versioncheck.yml' when: submodules_versioncheck|bool - name: Gather installed packages for checks later on ansible.builtin.package_facts: - manager: auto + manager: 'auto' - name: Prepare gitea/forgejo variable import block: - name: Gather variables for gitea or forgejo - ansible.builtin.include_vars: "{{ lookup('first_found', gitea_fork_variables) }}" + ansible.builtin.include_vars: + file: "{{ lookup('first_found', gitea_fork_variables) }}" rescue: - name: Gitea/Forejo import info ansible.builtin.fail: msg: "Currently only {{ gitea_supported_forks }} are supported." - name: Gather variables for each operating system - ansible.builtin.include_vars: "{{ lookup('first_found', gitea_variables) }}" + ansible.builtin.include_vars: + file: "{{ lookup('first_found', gitea_variables) }}" - name: Gather versioning information - ansible.builtin.include_tasks: "set_{{ gitea_fork | lower }}_version.yml" + ansible.builtin.include_tasks: + file: "set_{{ gitea_fork | lower }}_version.yml" - name: Backup gitea before update - ansible.builtin.include_tasks: backup.yml + ansible.builtin.include_tasks: + file: 'backup.yml' when: gitea_backup_on_upgrade|bool - name: Create gitea user and role - ansible.builtin.include_tasks: create_user.yml + ansible.builtin.include_tasks: + file: 'create_user.yml' - name: "Install or update {{ gitea_fork }}" - ansible.builtin.include_tasks: "install_{{ gitea_fork | lower }}.yml" + ansible.builtin.include_tasks: + file: "install_{{ gitea_fork | lower }}.yml" - name: Create directories - ansible.builtin.include_tasks: directory.yml + ansible.builtin.include_tasks: + file: 'directory.yml' - name: Setup gitea systemd service - ansible.builtin.include_tasks: install_systemd.yml + ansible.builtin.include_tasks: + file: 'install_systemd.yml' when: ansible_service_mgr == "systemd" - name: Generate JWT Secrets if undefined - ansible.builtin.include_tasks: jwt_secrets.yml + ansible.builtin.include_tasks: + file: 'jwt_secrets.yml' - name: Generate gitea secrets if undefined - ansible.builtin.include_tasks: gitea_secrets.yml + ansible.builtin.include_tasks: + file: 'gitea_secrets.yml' - name: Configure gitea - ansible.builtin.include_tasks: configure.yml + ansible.builtin.include_tasks: + file: 'configure.yml' - name: Deploy optional fail2ban rules - ansible.builtin.include_tasks: fail2ban.yml - when: gitea_fail2ban_enabled|bool + ansible.builtin.include_tasks: + file: 'fail2ban.yml' + when: gitea_fail2ban_enabled | bool - name: Optionally customize gitea - ansible.builtin.include_tasks: customize_logo.yml - when: gitea_customize_logo|bool + ansible.builtin.include_tasks: + file: 'customize_logo.yml' + when: gitea_customize_logo | bool - name: Optionally customize footer - ansible.builtin.include_tasks: customize_footer.yml - when: gitea_customize_footer|bool + ansible.builtin.include_tasks: + file: 'customize_footer.yml' + when: gitea_customize_footer | bool - name: Optionally deploy public files - ansible.builtin.include_tasks: customize_public_files.yml - when: gitea_customize_files|bool + ansible.builtin.include_tasks: + file: 'customize_public_files.yml' + when: gitea_customize_files | bool diff --git a/tasks/set_forgejo_version.yml b/tasks/set_forgejo_version.yml index 7b3d195..2c746eb 100644 --- a/tasks/set_forgejo_version.yml +++ b/tasks/set_forgejo_version.yml @@ -2,7 +2,7 @@ - name: "Check forgejo installed version" ansible.builtin.shell: "set -eo pipefail; {{ gitea_full_executable_path }} -v | cut -d' ' -f 3" args: - executable: /bin/bash + executable: '/bin/bash' register: gitea_active_version changed_when: false failed_when: false @@ -97,11 +97,11 @@ gitea_forgejo_signed_url: ['https://codeberg.org/attachments/ae5e50c6-e86e-4202-b95f-f142e8138e2f'] when: ansible_check_mode -- name: Show Download URLs +- name: Show Download URLs # noqa: H500 ansible.builtin.debug: msg: "{{ item }}" verbosity: 1 - with_items: + loop: - "gitea_forgejo_dl_url: {{ gitea_forgejo_dl_url | first }}" - "gitea_forgejo_checksum: {{ gitea_forgejo_checksum }}" - "gitea_forgejo_signed_url: {{ gitea_forgejo_signed_url | first }}" diff --git a/tasks/versioncheck.yml b/tasks/versioncheck.yml index dd22a1a..7dd80c5 100644 --- a/tasks/versioncheck.yml +++ b/tasks/versioncheck.yml @@ -7,7 +7,7 @@ ansible.builtin.file: path: '/etc/.ansible-version' state: directory - mode: 0755 + mode: '0755' when: submodules_versioncheck | bool - name: Check playbook version @@ -16,15 +16,14 @@ src: "/etc/.ansible-version/{{ playbook_version_path }}" register: playbook_version when: submodules_versioncheck | bool - ignore_errors: true failed_when: false -- name: Print remote role version +- name: Print remote role version # noqa: H500 ansible.builtin.debug: msg: "Remote role version: {{ playbook_version.content | default('Y3VycmVudGx5IG5vdCBkZXBsb3llZAo=') | b64decode | string }}" when: submodules_versioncheck | bool -- name: Print locale role version +- name: Print locale role version # noqa: H500 ansible.builtin.debug: msg: "Local role version: '{{ playbook_version_number | string }}'." when: submodules_versioncheck | bool From e03ee5a18f815e04fd1495d36353c176cda2a940 Mon Sep 17 00:00:00 2001 From: L3D Date: Sun, 29 Oct 2023 16:11:54 +0100 Subject: [PATCH 18/31] Increase version --- vars/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vars/main.yml b/vars/main.yml index ba8f195..c3a116d 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: 52 # should be int +playbook_version_number: 53 # should be int playbook_version_path: 'do1jlr.gitea.version' From 124579bddde0f5f38d0ccb326fc5c6db1178886c Mon Sep 17 00:00:00 2001 From: L3D Date: Sun, 29 Oct 2023 16:15:29 +0100 Subject: [PATCH 19/31] Update README.md Signed-off-by: L3D --- README.md | 9 --------- 1 file changed, 9 deletions(-) diff --git a/README.md b/README.md index f1df09c..f00708a 100644 --- a/README.md +++ b/README.md @@ -397,14 +397,5 @@ Mastodon [@l3d@chaos.social](https://chaos.social/@l3d). I'll be happy to fix any issues you raise, or even better, review your pull requests :) -## Testing -There are some tests that will validate the linting. A good test CI pipeline that works with the systemd commands used is still needed. - -| test status | Github Marketplace | -| :--------- | :---------------- | -| [![Galaxy release](https://github.com/roles-ansible/ansible_role_gitea/actions/workflows/galaxy.yml/badge.svg)](https://github.com/roles-ansible/ansible_role_gitea/actions/workflows/galaxy.yml) | [publish-ansible-role-to-galaxy](https://github.com/marketplace/actions/publish-ansible-role-to-galaxy) | -| [![Yamllint GitHub Actions](https://github.com/roles-ansible/ansible_role_gitea/actions/workflows/yamllint.yaml/badge.svg)](https://github.com/roles-ansible/ansible_role_gitea/actions/workflows/yamllint.yaml) | [yamllint-github-action](https://github.com/marketplace/actions/yamllint-github-action) | -| [![Ansible Lint check](https://github.com/roles-ansible/ansible_role_gitea/actions/workflows/ansible-linting-check.yml/badge.svg)](https://github.com/roles-ansible/ansible_role_gitea/actions/workflows/ansible-linting-check.yml) | [ansible-lint action](https://github.com/marketplace/actions/ansible-lint) - ## History of this role this ansible role was originally developed on [github.com/thomas-maurice/ansible-role-gitea](https://github.com/thomas-maurice/ansible-role-gitea.git). 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. It is now Part of the [l3d.git](https://galaxy.ansible.com/l3d/git) Collection too. From 1edd1c03d9b0b63196b55fb0ea6bd17a2043602e Mon Sep 17 00:00:00 2001 From: Andreas Brain Date: Thu, 30 Nov 2023 17:54:39 +0100 Subject: [PATCH 20/31] Update galaxy.yml Add missing brace to fix syntax issue Signed-off-by: Andreas Brain --- .github/workflows/galaxy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/galaxy.yml b/.github/workflows/galaxy.yml index ebfc532..b44f94e 100644 --- a/.github/workflows/galaxy.yml +++ b/.github/workflows/galaxy.yml @@ -21,4 +21,4 @@ jobs: - name: 'Release on galaxy' uses: ansible-actions/ansible-galaxy-action@v1.1.1 with: - galaxy_api_key: ${{ secrets.galaxy_api_key } + galaxy_api_key: ${{ secrets.galaxy_api_key }} From 3f80d8f0c7ebed1134d79bfc79d2eca2c089e883 Mon Sep 17 00:00:00 2001 From: L3D Date: Thu, 30 Nov 2023 18:05:37 +0100 Subject: [PATCH 21/31] change galaxy releasing action --- .github/workflows/galaxy.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/galaxy.yml b/.github/workflows/galaxy.yml index b44f94e..05e7d73 100644 --- a/.github/workflows/galaxy.yml +++ b/.github/workflows/galaxy.yml @@ -22,3 +22,4 @@ jobs: uses: ansible-actions/ansible-galaxy-action@v1.1.1 with: galaxy_api_key: ${{ secrets.galaxy_api_key }} + galaxy_version: 'main' From 5db197a4e5bcf40fc3042a5fcfedc9da206e10eb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 15 Dec 2023 06:01:46 +0000 Subject: [PATCH 22/31] Bump ansible-actions/ansible-galaxy-action from 1.1.1 to 1.2.0 Bumps [ansible-actions/ansible-galaxy-action](https://github.com/ansible-actions/ansible-galaxy-action) from 1.1.1 to 1.2.0. - [Release notes](https://github.com/ansible-actions/ansible-galaxy-action/releases) - [Commits](https://github.com/ansible-actions/ansible-galaxy-action/compare/v1.1.1...v1.2.0) --- updated-dependencies: - dependency-name: ansible-actions/ansible-galaxy-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .github/workflows/galaxy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/galaxy.yml b/.github/workflows/galaxy.yml index 05e7d73..1fb3acd 100644 --- a/.github/workflows/galaxy.yml +++ b/.github/workflows/galaxy.yml @@ -19,7 +19,7 @@ jobs: fetch-depth: 0 - name: 'Release on galaxy' - uses: ansible-actions/ansible-galaxy-action@v1.1.1 + uses: ansible-actions/ansible-galaxy-action@v1.2.0 with: galaxy_api_key: ${{ secrets.galaxy_api_key }} galaxy_version: 'main' From a085e0cc5c81e354417819aa9911227da1a81f35 Mon Sep 17 00:00:00 2001 From: Jeffrey van Pelt Date: Mon, 8 Jan 2024 16:47:39 +0100 Subject: [PATCH 23/31] Added check to stop execution when the remote version is higher then the currently installed --- tasks/set_gitea_version.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tasks/set_gitea_version.yml b/tasks/set_gitea_version.yml index c01a674..7674b7f 100644 --- a/tasks/set_gitea_version.yml +++ b/tasks/set_gitea_version.yml @@ -40,6 +40,12 @@ gitea_version_target: "{{ gitea_version }}" when: gitea_version != "latest" +- name: 'Assert that remote version is higher' + ansible.builtin.assert: + that: + - gitea_active_version is version(gitea_remote_version, 'lt') + fail_msg: ERROR: Remote version is lower then current version! + - name: "Generate gitea download URL" ansible.builtin.set_fact: gitea_dl_url: "https://github.com/go-gitea/gitea/releases/download/v{{ gitea_version_target }}/gitea-{{ gitea_version_target }}-linux-{{ gitea_arch }}" From 69f9ebfedfa2fe9631b3d0024f25ab0a92bfe3c9 Mon Sep 17 00:00:00 2001 From: Jeffrey van Pelt Date: Mon, 8 Jan 2024 16:50:45 +0100 Subject: [PATCH 24/31] Added check to Forgejo --- tasks/set_forgejo_version.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tasks/set_forgejo_version.yml b/tasks/set_forgejo_version.yml index 2c746eb..210066c 100644 --- a/tasks/set_forgejo_version.yml +++ b/tasks/set_forgejo_version.yml @@ -97,6 +97,12 @@ gitea_forgejo_signed_url: ['https://codeberg.org/attachments/ae5e50c6-e86e-4202-b95f-f142e8138e2f'] when: ansible_check_mode +- name: 'Assert that remote version is higher' + ansible.builtin.assert: + that: + - gitea_active_version is version(gitea_remote_version, 'lt') + fail_msg: ERROR: Remote version is lower then current version! + - name: Show Download URLs # noqa: H500 ansible.builtin.debug: msg: "{{ item }}" From c8a60c89ba8997fe4917e9af44482d713d57980f Mon Sep 17 00:00:00 2001 From: Jeffrey van Pelt Date: Mon, 8 Jan 2024 16:54:10 +0100 Subject: [PATCH 25/31] Make linter happy --- tasks/set_forgejo_version.yml | 2 +- tasks/set_gitea_version.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tasks/set_forgejo_version.yml b/tasks/set_forgejo_version.yml index 210066c..815863a 100644 --- a/tasks/set_forgejo_version.yml +++ b/tasks/set_forgejo_version.yml @@ -101,7 +101,7 @@ ansible.builtin.assert: that: - gitea_active_version is version(gitea_remote_version, 'lt') - fail_msg: ERROR: Remote version is lower then current version! + fail_msg: ERROR - Remote version is lower then current version! - name: Show Download URLs # noqa: H500 ansible.builtin.debug: diff --git a/tasks/set_gitea_version.yml b/tasks/set_gitea_version.yml index 7674b7f..1c27d7b 100644 --- a/tasks/set_gitea_version.yml +++ b/tasks/set_gitea_version.yml @@ -44,7 +44,7 @@ ansible.builtin.assert: that: - gitea_active_version is version(gitea_remote_version, 'lt') - fail_msg: ERROR: Remote version is lower then current version! + fail_msg: ERROR - Remote version is lower then current version! - name: "Generate gitea download URL" ansible.builtin.set_fact: From e853561bdf3c437304913f98c4b159d79d74b9a9 Mon Sep 17 00:00:00 2001 From: L3D Date: Fri, 12 Jan 2024 00:50:37 +0100 Subject: [PATCH 26/31] Only check for version if gitea==latest and already installed --- tasks/set_forgejo_version.yml | 1 + tasks/set_gitea_version.yml | 1 + vars/main.yml | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/tasks/set_forgejo_version.yml b/tasks/set_forgejo_version.yml index 815863a..554dfcd 100644 --- a/tasks/set_forgejo_version.yml +++ b/tasks/set_forgejo_version.yml @@ -102,6 +102,7 @@ that: - gitea_active_version is version(gitea_remote_version, 'lt') fail_msg: ERROR - Remote version is lower then current version! + when: gitea_version == "latest" and gitea_active_version.stderr == "" | bool - name: Show Download URLs # noqa: H500 ansible.builtin.debug: diff --git a/tasks/set_gitea_version.yml b/tasks/set_gitea_version.yml index 1c27d7b..0c9880b 100644 --- a/tasks/set_gitea_version.yml +++ b/tasks/set_gitea_version.yml @@ -45,6 +45,7 @@ that: - gitea_active_version is version(gitea_remote_version, 'lt') fail_msg: ERROR - Remote version is lower then current version! + when: gitea_version == "latest" and gitea_active_version.stderr == "" | bool - name: "Generate gitea download URL" ansible.builtin.set_fact: diff --git a/vars/main.yml b/vars/main.yml index c3a116d..63b02d2 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: 53 # should be int +playbook_version_number: 54 playbook_version_path: 'do1jlr.gitea.version' From 6009cbc41494d5dc522764770b94481a96579a02 Mon Sep 17 00:00:00 2001 From: L3D Date: Fri, 12 Jan 2024 00:59:28 +0100 Subject: [PATCH 27/31] Change gitea_customize_files_path to / at end --- defaults/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/defaults/main.yml b/defaults/main.yml index 62c2fa4..f460e4e 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -274,4 +274,4 @@ gitea_customize_logo: false gitea_custom: "{{ gitea_home }}/custom" gitea_customize_footer: false gitea_customize_files: false -gitea_customize_files_path: "{{ gitea_custom_search }}/gitea_files" +gitea_customize_files_path: "{{ gitea_custom_search }}/gitea_files/" From 5e9eccc7e39b3ed8f545e1d743724f80bbc455b1 Mon Sep 17 00:00:00 2001 From: L3D Date: Fri, 12 Jan 2024 01:14:31 +0100 Subject: [PATCH 28/31] Update readme and names --- README.md | 6 ++++++ tasks/main.yml | 2 +- vars/main.yml | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f00708a..e14d3e8 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,12 @@ This role installs and manages [gitea](https://gitea.io) or [forgejo](https://fo [Source code forgejo](https://codeberg.org/forgejo/forgejo). This role is also Part of the Ansible-Collection [l3d.git](https://galaxy.ansible.com/l3d/git). [![l3d.git](https://ansible.l3d.space/svg/l3d.git_ansible-collection_collection.svg)](https://github.com/roles-ansible/ansible_collection_git.git). +## Mirrors +The role is mirrored to: ++ Github: [github.com/roles-ansible/ansible_role_gitea](https://github.com/roles-ansible/ansible_role_gitea.git) ++ Gitea: [git.l3d.ch/ansible/ansible_role_gitea](https://git.l3d.ch/ansible/ansible_role_gitea.git) +More about it at [ansible.l3d.space](https://ansible.l3d.space/#l3d.gitea) + ## Sample Usage in a playbook The following code has been tested with the latest Debian Stable, it should work on Ubuntu and RedHat as well. diff --git a/tasks/main.yml b/tasks/main.yml index c1862f4..935c0b6 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -31,7 +31,7 @@ file: 'backup.yml' when: gitea_backup_on_upgrade|bool -- name: Create gitea user and role +- name: Create gitea user and group ansible.builtin.include_tasks: file: 'create_user.yml' diff --git a/vars/main.yml b/vars/main.yml index 63b02d2..34d8ea4 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: 54 +playbook_version_number: 55 playbook_version_path: 'do1jlr.gitea.version' From 9795ee8b472a5975183c7c8568d81e542c2bac26 Mon Sep 17 00:00:00 2001 From: privatewright Date: Mon, 15 Jan 2024 21:19:06 +0700 Subject: [PATCH 29/31] Fix typo in README According to `defaults/main.yml`, the default value for `gitea_default_allow_create_organization` variable is `false`. However in the current README, the default value is `true`. This commit will fix the disrepancy. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e14d3e8..aee909f 100644 --- a/README.md +++ b/README.md @@ -229,7 +229,7 @@ Either you define exactly which release you install. Or you use the option ``lat | `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_default_allow_create_organization` | `false` | 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". | From dba4c60d7aa25270597dbab00804fb2b5e77f797 Mon Sep 17 00:00:00 2001 From: L3D Date: Thu, 25 Jan 2024 00:02:38 +0100 Subject: [PATCH 30/31] Create systemd unit for all systems --- README.md | 2 +- tasks/install_systemd.yml | 16 +--------------- vars/debian.yml | 2 ++ vars/main.yml | 3 ++- vars/os_fallback_defaults.yml | 7 +++++++ vars/redhat.yml | 2 ++ vars/suse.yml | 2 ++ 7 files changed, 17 insertions(+), 17 deletions(-) create mode 100644 vars/os_fallback_defaults.yml diff --git a/README.md b/README.md index aee909f..1732317 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![Ansible Galaxy](https://ansible.l3d.space/svg/l3d.gitea.svg)](https://galaxy.ansible.com/ui/standalone/roles/l3d/gitea/) +[![Ansible Galaxy](https://ansible.l3d.space/svg/l3d.gitea.svg)](https://galaxy.ansible.com/ui/standalone/roles/roles-ansible/gitea/) [![BSD-3 Clause](https://ansible.l3d.space/svg/l3d.gitea_license.svg)](LICENSE) [![Maintainance](https://ansible.l3d.space/svg/l3d.gitea_maintainance.svg)](https://ansible.l3d.space/#l3d.gitea) diff --git a/tasks/install_systemd.yml b/tasks/install_systemd.yml index 1d0084a..6a441cb 100644 --- a/tasks/install_systemd.yml +++ b/tasks/install_systemd.yml @@ -1,23 +1,9 @@ --- - name: "Setup systemd service" become: true - when: ansible_os_family == "Debian" ansible.builtin.template: src: gitea.service.j2 - dest: /lib/systemd/system/gitea.service - owner: root - group: root - mode: 0644 - notify: - - "Reload systemd" - - "Restart gitea" - -- name: "Setup systemd service" - become: true - when: ansible_os_family == "Suse" - ansible.builtin.template: - src: gitea.service.j2 - dest: /etc/systemd/system/gitea.service + dest: "{{ gitea_systemd_path }}/gitea.service" owner: root group: root mode: 0644 diff --git a/vars/debian.yml b/vars/debian.yml index dc164f6..784471f 100644 --- a/vars/debian.yml +++ b/vars/debian.yml @@ -3,3 +3,5 @@ gitea_dependencies: - git - gnupg2 - xz-utils + +gitea_systemd_path: '/lib/systemd/system' diff --git a/vars/main.yml b/vars/main.yml index 34d8ea4..cb466f6 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -23,6 +23,7 @@ gitea_variables: - "{{ ansible_os_family | lower }}-{{ ansible_distribution_major_version | lower }}.yml" - "{{ ansible_distribution | lower }}.yml" - "{{ ansible_os_family | lower }}.yml" + - 'os_fallback_defaults.yml' paths: - 'vars' @@ -62,5 +63,5 @@ transfer_custom_footer: - 'files/gitea_footer/extra_links_footer.tmpl' - 'files/extra_links_footer.tmpl' -playbook_version_number: 55 +playbook_version_number: 56 playbook_version_path: 'do1jlr.gitea.version' diff --git a/vars/os_fallback_defaults.yml b/vars/os_fallback_defaults.yml new file mode 100644 index 0000000..784471f --- /dev/null +++ b/vars/os_fallback_defaults.yml @@ -0,0 +1,7 @@ +--- +gitea_dependencies: + - git + - gnupg2 + - xz-utils + +gitea_systemd_path: '/lib/systemd/system' diff --git a/vars/redhat.yml b/vars/redhat.yml index 7c96415..393ab8d 100644 --- a/vars/redhat.yml +++ b/vars/redhat.yml @@ -3,3 +3,5 @@ gitea_dependencies: - git - gnupg2 - xz + +gitea_systemd_path: '/lib/systemd/system' diff --git a/vars/suse.yml b/vars/suse.yml index 027026e..157ba4d 100644 --- a/vars/suse.yml +++ b/vars/suse.yml @@ -3,3 +3,5 @@ gitea_dependencies: - git - gpg2 - xz + +gitea_systemd_path: '/etc/systemd/system' From 711c53cd395f982f094d1c44bf2ec11a524a9b37 Mon Sep 17 00:00:00 2001 From: Adrian Simmons Date: Fri, 16 Feb 2024 12:55:30 +0000 Subject: [PATCH 31/31] Add a note about Forgejo version and 'latest' --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 1732317..5abe886 100644 --- a/README.md +++ b/README.md @@ -52,6 +52,11 @@ You have the option to choose between [gitea](https://gitea.io) and [forgejo](ht 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](https://github.com/go-gitea/gitea/releases/latest). +### Forgejo update mechanism +It is advisable to define exactly which Forgejo release you want to install. See [Forgejo releases](https://forgejo.org/releases/) for the correct value to use in `gitea_version` eg `v1.21.5`. + +This is because the Forgejo project maintains both `stable` and `old stable` releases and the `latest` tag will refer to the *most recent release* regardless of whether it is `stable` or `old stable`. This can lead to a situation where `latest` refers to an *older release* than the version you have installed. + ### gitea update | variable name | default value | description | | ------------- | ------------- | ----------- |