diff --git a/defaults/main.yml b/defaults/main.yml index 0a26f1f..d7d6cea 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -11,6 +11,13 @@ fastbuild_cache_dir: C:\fbuild # User who will own the FASTBuild configuration directory. fastbuild_cache_owner: "jenkins" +# If true, then add a scheduled task to regularly trim the cache. +fastbuild_cache_schedule_trim: true + +# How large the FASTBuild cache should be trimmed to (requires +# fastbuild_cache_schedule_trim to be true). +fastbuild_cache_trim_size_mb: 1024 + # Version of FASTBuild to install. fastbuild_version: "1.00" diff --git a/tasks/configure.yml b/tasks/configure.yml index cc7c158..9370920 100644 --- a/tasks/configure.yml +++ b/tasks/configure.yml @@ -11,3 +11,17 @@ name: "FASTBUILD_CACHE_PATH" value: "{{ fastbuild_cache_dir }}" level: machine + +- name: Add scheduled task to trim FASTBuild cache + win_scheduled_task: + name: "Trim FASTBuild cache" + username: "{{ fastbuild_cache_owner }}" + actions: + - path: "{{ fastbuild_path_win }}\\FBuild.exe" + arguments: "-cachetrim {{ fastbuild_cache_trim_size_mb }}" + triggers: + - type: daily + # This attribute is required by Ansible, but not really necessary for daily tasks. + # Hence, we choose a date far in the past. + start_boundary: "2000-01-01T00:00:00" + when: fastbuild_cache_schedule_trim