diff --git a/README.md b/README.md index bd5898e..8761d8b 100644 --- a/README.md +++ b/README.md @@ -9,13 +9,13 @@ Role Variables The most important variables are listed below: ``` yaml -gitea_version: 1.14.3 -gitea_local_postgresql: True -gitea_local_mysql: False -gitea_local_mariadb: False -gitea_nginx_frontend: True -gitea_local_redis: True -gitea_local_memcache: True +gitea_version: 1.21.11 +gitea_local_postgresql: true +gitea_local_mysql: false +gitea_local_mariadb: false +gitea_nginx_frontend: true +gitea_local_redis: true +gitea_local_memcache: true gitea_app_configurations: - { section: 'mailer', option: 'ENABLED', value: 'true', state: 'present' } - { section: 'mailer', option: 'FROM', value: '{{ gitea_mail_from }}', state: 'present' } diff --git a/defaults/main.yml b/defaults/main.yml index 34d5b8c..ebaa2a2 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -154,3 +154,16 @@ gitea_app_configurations: # - { section: 'mailer', option: 'SENDMAIL_PATH', value: '{{ gitea_sendmail_path }}', state: 'present' } # - { section: 'metrics', option: 'ENABLED', value: 'true', state: 'present' } # - { section: 'metrics', option: 'TOKEN', value: '{{ gitea_prometheus_bearer_token }}', state: 'present' } + +gitea_enable_repository_archives_cron_jobs: true +gitea_rep_archives_configuration: + - { section: 'cron.archive_cleanup', option: 'ENABLED', value: 'true', state: 'present' } + - { section: 'cron.archive_cleanup', option: 'RUN_AT_START', value: 'false', state: 'present' } + - { section: 'cron.archive_cleanup', option: 'NOTICE_ON_SUCCESS', value: 'false', state: 'present' } + - { section: 'cron.archive_cleanup', option: 'SCHEDULE', value: '@midnight', state: 'present' } + - { section: 'cron.archive_cleanup', option: 'OLDER_THAN', value: '24h', state: 'present' } + - { section: 'cron.delete_repo_archives', option: 'ENABLED', value: 'true', state: 'present' } + - { section: 'cron.delete_repo_archives', option: 'RUN_AT_START', value: 'false', state: 'present' } + - { section: 'cron.delete_repo_archives', option: 'NOTICE_ON_SUCCESS', value: 'false', state: 'present' } + - { section: 'cron.delete_repo_archives', option: 'SCHEDULE', value: '@weekly', state: 'present' } + - { section: 'cron.delete_repo_archives', option: '', value: '', state: 'present' } diff --git a/files/header.tmpl b/files/header.tmpl index 2cd2f66..f20f53c 100644 --- a/files/header.tmpl +++ b/files/header.tmpl @@ -1,3 +1,3 @@ - + diff --git a/meta/main.yml b/meta/main.yml index 8c60183..c038cd3 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -7,7 +7,7 @@ galaxy_info: license: EUPL 1.2+ - min_ansible_version: "2.8" + min_ansible_version: "2.9" platforms: - name: Ubuntu diff --git a/tasks/gitea.yml b/tasks/gitea.yml index 5ae7b42..3864b40 100644 --- a/tasks/gitea.yml +++ b/tasks/gitea.yml @@ -90,37 +90,9 @@ force: false notify: restart gitea - - name: gitea | Change the gitea configuration. After the installation - 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_app_configurations }}' - when: gitea_app_configurations is defined - notify: restart gitea - tags: ['git', 'gitea', 'gitea_conf'] - - - name: gitea | Prometheus metrics - 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_prometheus_conf }}' - notify: restart gitea - tags: ['git', 'gitea', 'gitea_conf'] - +- name: gitea | Manage the gitea configuration settings + tags: [git, gitea, gitea_conf] + block: - name: gitea | Create the tmpfile entry for the gitea socket directory ansible.builtin.template: src: tmpfile_gitea.conf.j2 @@ -140,7 +112,51 @@ - 'templates/custom' - 'public/assets/css' - 'public/assets/components' - tags: ['git', 'gitea', 'gitea_conf'] + + - name: gitea | Change the gitea configuration. After the installation + 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_app_configurations }}' + when: gitea_app_configurations is defined + notify: restart gitea + + - name: gitea | Prometheus metrics + 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_prometheus_conf }}' + notify: restart gitea + + - name: gitea | Configure some repository archives cron jobs + 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_rep_archives_configuration }}' + when: gitea_enable_repository_archives_cron_jobs + notify: restart gitea + - name: gitea | Gitea systemd service tags: ['git', 'gitea', 'gitea_service']