From f1d795710d879064ff3e2f6ef68b15bcee1b9a55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reynir=20Bj=C3=B6rnsson?= Date: Thu, 23 Jan 2025 10:44:54 +0000 Subject: [PATCH] Mastodon: prune profile media monthly (#228) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently running this with --days 14 and am seeing gigabytes freed. Before freeing: Avatars: 29.6 GB (1.92 MB local) Headers: 66.2 GB (6.17 MB local) Reviewed-on: https://git.data.coop/data.coop/ansible/pulls/228 Co-authored-by: Reynir Björnsson Co-committed-by: Reynir Björnsson --- roles/docker/tasks/post_deploy/mastodon.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/roles/docker/tasks/post_deploy/mastodon.yml b/roles/docker/tasks/post_deploy/mastodon.yml index 06c3bdd..579c86f 100644 --- a/roles/docker/tasks/post_deploy/mastodon.yml +++ b/roles/docker/tasks/post_deploy/mastodon.yml @@ -9,6 +9,15 @@ user: root state: present +- name: Configure cron job to remove old Mastodon profile media such as avatars and headers + cron: + name: Clean Mastodon profile media older than thirty days + cron_file: ansible_mastodon_clean_media_profile + job: docker exec mastodon-web-1 tootctl media remove --profile --days 30 + special_time: daily + user: root + state: present + - name: Configure cron job to remove old Mastodon preview cards daily cron: name: Clean Mastodon preview card data older than two weeks