This commit is contained in:
Sam A. 2024-03-30 19:16:29 +01:00
parent b8bca56c76
commit 54249980e9
Signed by: samsapti
GPG key ID: CBBBE7371E81C4EA
5 changed files with 23 additions and 28 deletions

View file

@ -177,7 +177,6 @@ services:
domain: "social.{{ base_domain }}" domain: "social.{{ base_domain }}"
volume_folder: "{{ volume_root_folder }}/mastodon" volume_folder: "{{ volume_root_folder }}/mastodon"
pre_deploy_tasks: true pre_deploy_tasks: true
post_deploy_tasks: true
version: v4.2.8 version: v4.2.8
postgres_version: 14-alpine postgres_version: 14-alpine
redis_version: 6-alpine redis_version: 6-alpine

View file

@ -21,8 +21,8 @@
when: deploy_services is defined and deploy_services when: deploy_services is defined and deploy_services
block: block:
- name: Deploy Compose stack for service '{{ service.name }}' - name: Deploy Compose stack for service '{{ service.name }}'
ansible.builtin.command: docker compose up -d --remove-orphans --pull always ansible.builtin.command:
args: cmd: docker compose up -d --remove-orphans
chdir: "{{ service.vars.volume_folder }}" chdir: "{{ service.vars.volume_folder }}"
- name: Run post-deployment tasks for service '{{ service.name }}' - name: Run post-deployment tasks for service '{{ service.name }}'

View file

@ -11,16 +11,14 @@
apt_repository: apt_repository:
repo: deb https://download.docker.com/linux/ubuntu bionic stable repo: deb https://download.docker.com/linux/ubuntu bionic stable
state: present state: present
update_cache: yes update_cache: true
- name: Install Docker - name: Install Docker
apt: apt:
name: "{{ pkgs }}" name:
state: present
vars:
pkgs:
- docker-ce - docker-ce
- docker-compose-plugin - docker-compose-plugin
state: present
- name: Configure cron job to prune unused Docker data weekly - name: Configure cron job to prune unused Docker data weekly
cron: cron:

View file

@ -1,20 +0,0 @@
# vim: ft=yaml.ansible
# code: language=ansible
---
- name: Configure cron job to remove old Mastodon media daily
cron:
name: Clean Mastodon media data older than a week
cron_file: ansible_mastodon_clean_media
job: docker exec mastodon-web-1 tootctl media remove --days 7
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
cron_file: ansible_mastodon_clean_preview_cards
job: docker exec mastodon-web-1 tootctl preview_cards remove --days 14
special_time: daily
user: root
state: present

View file

@ -44,3 +44,21 @@
copy: copy:
src: mastodon/postgresql.conf src: mastodon/postgresql.conf
dest: "{{ services.mastodon.volume_folder }}/postgres_config/postgresql.conf" dest: "{{ services.mastodon.volume_folder }}/postgres_config/postgresql.conf"
- name: Configure cron job to remove old Mastodon media daily
ansible.builtin.cron:
name: Clean Mastodon media data older than a week
cron_file: ansible_mastodon_clean_media
job: docker compose -f {{ services.mastodon.volume_folder }}/docker-compose.yml exec web tootctl media remove --days 7
special_time: daily
user: root
state: present
- name: Configure cron job to remove old Mastodon preview cards daily
ansible.builtin.cron:
name: Clean Mastodon preview card data older than two weeks
cron_file: ansible_mastodon_clean_preview_cards
job: docker compose -f {{ services.mastodon.volume_folder }}/docker-compose.yml exec web tootctl preview_cards remove --days 14
special_time: daily
user: root
state: present