cleanup: rename purge script to be a cleanup script

Also move script to files since it's not a template.

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2023-12-08 16:01:09 +01:00
parent 7ba600d79a
commit 8a13f35339
No known key found for this signature in database
GPG Key ID: FE65CD384D5BF7B4
5 changed files with 35 additions and 35 deletions

View File

@ -56,12 +56,12 @@ gitea_organizations: []
# - org1
# - org2
# Purge
gitea_container_purge_timer_name: 'gitea-purge-artifact'
gitea_container_purge_timer_user: '{{ gitea_app_host_uid }}'
gitea_container_purge_timer_frequency: 'daily'
gitea_container_purge_timer_timeout: 120
gitea_purge_max_retention: 15
# Cleanup
gitea_container_cleanup_timer_name: 'gitea-cleanup-artifact'
gitea_container_cleanup_timer_user: '{{ gitea_app_host_uid }}'
gitea_container_cleanup_timer_frequency: 'daily'
gitea_container_cleanup_timer_timeout: 120
gitea_cleanup_max_retention: 15
# General container management
compose_recreate: 'smart'

27
tasks/cleanup.yml Normal file
View File

@ -0,0 +1,27 @@
---
- name: Copy registry cleanup script
copy:
src: 'cleanup-registry.py'
dest: '{{ gitea_service_path }}/cleanup-registry.py'
owner: '{{ gitea_app_host_uid }}'
group: docker
mode: 0755
- name: 'Create timer for launch the clean up of workspace '
include_role: name=systemd-timer
vars:
systemd_timer_name: '{{ gitea_container_cleanup_timer_name }}'
systemd_timer_description: 'Timer to perform clean '
systemd_timer_dynamic_user: true
systemd_timer_frequency: '{{ gitea_container_cleanup_timer_frequency }}'
systemd_timer_timeout_sec: '{{ gitea_container_cleanup_timer_timeout }}'
systemd_timer_work_dir: '{{ gitea_service_path }}'
systemd_timer_requires_extra: 'docker.service'
systemd_timer_start_on_creation: false
systemd_timer_script_path: '{{ gitea_service_path}}/cleanup-registry.py'
systemd_timer_script_args: >-
--url http://localhost:{{ gitea_app_cont_web_port }}
--retention {{ gitea_cleanup_max_retention }}
systemd_timer_environment:
GITEA_USERNAME: '{{ gitea_app_admin_user | mandatory }}'
GITEA_PASSWORD: '{{ gitea_app_admin_pass | mandatory }}'

View File

@ -13,5 +13,5 @@
tags: ['role::gitea', 'role::gitea:consul']
- import_tasks: init-registry.yml
tags: ['role::gitea', 'role::gitea:init-registry']
- import_tasks: purge-registry.yml
tags: ['role::gitea', 'role::gitea:purge-registry']
- import_tasks: cleanup.yml
tags: ['role::gitea', 'role::gitea:cleanup']

View File

@ -1,27 +0,0 @@
---
- name: Copy init script
template:
src: 'purge-registry.py.j2'
dest: '{{ gitea_service_path }}/purge-registry.py'
owner: '{{ gitea_app_host_uid }}'
group: docker
mode: 0755
- name: 'Create timer for launch the clean up of workspace '
include_role: name=systemd-timer
vars:
systemd_timer_name: '{{ gitea_container_purge_timer_name }}'
systemd_timer_description: 'Timer to perform clean '
systemd_timer_dynamic_user: true
systemd_timer_frequency: '{{ gitea_container_purge_timer_frequency }}'
systemd_timer_timeout_sec: '{{ gitea_container_purge_timer_timeout }}'
systemd_timer_work_dir: '{{ gitea_service_path }}'
systemd_timer_requires_extra: 'docker.service'
systemd_timer_start_on_creation: false
systemd_timer_script_path: '{{ gitea_service_path}}/purge-registry.py'
systemd_timer_script_args: >-
--url http://localhost:{{ gitea_app_cont_web_port }}
--retention {{ gitea_purge_max_retention }}
systemd_timer_environment:
GITEA_USERNAME: '{{ gitea_app_admin_user | mandatory }}'
GITEA_PASSWORD: '{{ gitea_app_admin_pass | mandatory }}'