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 }}