File tree 4 files changed +63
-8
lines changed
4 files changed +63
-8
lines changed Original file line number Diff line number Diff line change @@ -45,6 +45,42 @@ cvmfs_config_apache: true
45
45
# group_names
46
46
cvmfs_role : ' ' # (client, Or stratum1 or stratum0 or localproxy)
47
47
48
+ # Specify whether `cvmfs_server gc -a` should be run from cron to garbage collect all repos on the server, disable this
49
+ # option if your repos don't use CVMFS_AUTO_GC=false.
50
+ cvmfs_gc_enabled : true
51
+
52
+ # Garbage collection log path (directory will be created if necessary). This is the default path but CVMFS packages
53
+ # don't precreate the directory for you so `cvmfs_server gc -a` will fail by default.
54
+ cvmfs_gc_log : /var/log/cvmfs/gc.log
55
+
56
+ # User to run garbage collection as. This user must have permission to gc all repositories on the server (i.e. it should
57
+ # be `root` if you have repositories owned by multiple users)
58
+ cvmfs_gc_user : root
59
+
60
+ # Specify the options passed to `cvmfs_server gc`. If you override these you will need to include `-a -f` in your value
61
+ # or the job will fail
62
+ cvmfs_gc_options : " -a -f -L {{ cvmfs_gc_log }}"
63
+
64
+ # Garbage collection cron job timing, hash keys correspond to the cron module options:
65
+ # https://docs.ansible.com/ansible/latest/collections/ansible/builtin/cron_module.html
66
+ #
67
+ # cvmfs_gc_time:
68
+ # special_time:
69
+ # hour:
70
+ # minute:
71
+ # day:
72
+ # month:
73
+ # weekday:
74
+ #
75
+ # e.g. for 3 AM nightly:
76
+ # cvmfs_gc_time:
77
+ # hour: 3
78
+ # minute: 0
79
+ #
80
+ # Use @weekly by default:
81
+ cvmfs_gc_time :
82
+ special_time : weekly
83
+
48
84
# Optionally download the preload utility
49
85
cvmfs_preload_install : false
50
86
cvmfs_preload_path : /usr/bin
Original file line number Diff line number Diff line change 1
1
---
2
2
3
- - name : Schedule garbage collection
3
+ # gc -a support implemented in 2021/02, this task can be removed at some later date
4
+ - name : Remove per-repository garbage collection cron jobs
4
5
cron :
5
- name : cvmfs_gc_{{ item.1. repository }}
6
+ name : cvmfs_gc_{{ item.repository }}
6
7
cron_file : ansible_cvmfs_gc
7
- user : " {{ item.1.owner | default('root') }}"
8
- job : output=$(/usr/bin/cvmfs_server gc -f -t '1 Jan 1970 00:00:00' {{ item.1.repository }} 2>&1) || echo "$output"
9
- hour : 3
10
- minute : " {{ item.0 }}"
11
- weekday : 3
12
- with_indexed_items : " {{ cvmfs_repositories }}"
8
+ state : absent
9
+ loop : " {{ cvmfs_repositories }}"
10
+
11
+ - name : Create garbage collection log directory
12
+ file :
13
+ path : " {{ cvmfs_gc_log | dirname }}"
14
+ state : directory
15
+ owner : " {{ cvmfs_gc_user }}"
16
+ mode : 0755
17
+
18
+ - name : Schedule garbage collection
19
+ cron :
20
+ name : cvmfs_gc_all
21
+ cron_file : ansible_cvmfs_gc_all
22
+ user : " {{ cvmfs_gc_user }}"
23
+ job : /usr/bin/cvmfs_server gc {{ cvmfs_gc_options }}
24
+ hour : " {{ cvmfs_gc_time.hour | default(omit) }}"
25
+ minute : " {{ cvmfs_gc_time.minute | default(omit) }}"
26
+ day : " {{ cvmfs_gc_time.day | default(omit) }}"
27
+ month : " {{ cvmfs_gc_time.month | default(omit) }}"
28
+ weekday : " {{ cvmfs_gc_time.weekday | default(omit) }}"
29
+ special_time : " {{ cvmfs_gc_time.special_time | default(omit) }}"
Original file line number Diff line number Diff line change 88
88
89
89
- name : Include garbage collection tasks
90
90
include_tasks : gc.yml
91
+ when : cvmfs_gc_enabled
Original file line number Diff line number Diff line change 114
114
115
115
- name : Include garbage collection tasks
116
116
include_tasks : gc.yml
117
+ when : cvmfs_gc_enabled
117
118
118
119
# allow unprivileged users to restart squid
119
120
- name : Allow users to manage services
You can’t perform that action at this time.
0 commit comments