From afed82bf44f29daeb2f9d68f54741533be89e95d Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Sun, 28 Apr 2024 16:12:16 +0200 Subject: [PATCH] Move the LFS configuration in a dedicated task. --- defaults/main.yml | 5 +++++ tasks/gitea.yml | 13 +++++++++++++ templates/app.ini.j2 | 3 --- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index ebaa2a2..ce38979 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -48,6 +48,11 @@ gitea_start_lfs: 'true' gitea_lfs_content_path: '{{ gitea_data_dir }}/data/lfs' #gitea_lfs_jwt_secret: put it into a vault file gitea_lfs_http_auth_expiry: 20m +gitea_lfs_configuration: + - { section: 'server', option: 'LFS_START_SERVER', value: '{{ gitea_start_lfs }}', state: 'present' } + - { section: 'server', option: 'LFS_HTTP_AUTH_EXPIRY', value: '{{ gitea_lfs_http_auth_expiry }}', state: 'present' } + - { section: 'server', option: 'LFS_CONTENT_PATH', value: '{{ gitea_lfs_content_path }}', state: 'absent' } + - { section: 'lfs', option: 'PATH', value: '{{ gitea_lfs_content_path }}', state: 'present' } gitea_required_packages: - git diff --git a/tasks/gitea.yml b/tasks/gitea.yml index d89c5a0..95bd0f6 100644 --- a/tasks/gitea.yml +++ b/tasks/gitea.yml @@ -157,6 +157,19 @@ when: gitea_enable_repository_archives_cron_jobs notify: Restart gitea + - name: gitea | LFS configuration + community.general.ini_file: + path: '{{ gitea_conf_dir }}/app.ini' + section: '{{ item.section }}' + option: '{{ item.option }}' + value: '{{ item.value }}' + state: '{{ item.state }}' + owner: '{{ gitea_user }}' + group: '{{ gitea_group }}' + mode: '0640' + create: false + loop: '{{ gitea_lfs_configuration }}' + notify: Restart gitea - name: gitea | Gitea systemd service tags: ['git', 'gitea', 'gitea_service'] diff --git a/templates/app.ini.j2 b/templates/app.ini.j2 index 48a9957..5a8efbc 100644 --- a/templates/app.ini.j2 +++ b/templates/app.ini.j2 @@ -11,9 +11,6 @@ MAX_CREATION_LIMIT = {{ gitea_max_repository_per_user }} PROTOCOL = {{ gitea_server_protocol }} HTTP_ADDR = {{ gitea_http_addr }} LANDING_PAGE = {{ gitea_landing_page }} -LFS_START_SERVER = {{ gitea_start_lfs }} -LFS_CONTENT_PATH = {{ gitea_lfs_content_path }} -LFS_HTTP_AUTH_EXPIRY = {{ gitea_lfs_http_auth_expiry }} SSH_DOMAIN = {{ gitea_hostname }} DOMAIN = {{ gitea_hostname }} HTTP_PORT = {{ gitea_http_port }}