datacoop.ansible/roles/docker/tasks/services/mastodon.yml

76 lines
2.1 KiB
YAML
Raw Normal View History

# vim: ft=yaml.ansible
---
2023-07-11 20:26:08 +00:00
- name: Create volume folder for Mastodon data
2022-05-07 20:53:18 +00:00
file:
2023-07-11 20:26:08 +00:00
name: "{{ services.mastodon.volume_folder }}/mastodon_data"
2022-05-07 20:53:18 +00:00
state: directory
owner: "991"
2023-07-11 20:26:08 +00:00
mode: u=rwx,g=rx,o=rx
- name: Create volume folder for PostgreSQL data
file:
name: "{{ services.mastodon.volume_folder }}/postgres_data"
state: directory
owner: "70"
mode: u=rwx,go=
- name: Create volume folder for PostgreSQL config
file:
name: "{{ services.mastodon.volume_folder }}/postgres_config"
state: directory
owner: root
mode: u=rwx,g=rx,o=rx
- name: Create volume folder for Redis data
file:
name: "{{ services.mastodon.volume_folder }}/redis_data"
state: directory
owner: "999"
group: "1000"
mode: u=rwx,g=rx,o=rx
2022-05-07 20:53:18 +00:00
- name: Copy mastodon environment file
template:
2023-08-05 17:35:55 +00:00
src: mastodon/env.j2
dest: "{{ services.mastodon.volume_folder }}/mastodon.env"
2022-05-07 20:53:18 +00:00
- name: Upload vhost config for Mastodon domain
copy:
src: vhost/mastodon
dest: "{{ services.nginx_proxy.volume_folder }}/vhost/{{ services.mastodon.domain }}"
2022-05-07 20:53:18 +00:00
- name: Copy PostgreSQL config
copy:
src: mastodon/postgresql.conf
dest: "{{ services.mastodon.volume_folder }}/postgres_config/postgresql.conf"
- name: Upload Compose file for Mastodon
template:
src: compose-files/mastodon.yml.j2
dest: "{{ services.mastodon.volume_folder }}/docker-compose.yml"
- name: Deploy Mastodon
2022-05-07 20:53:18 +00:00
docker_compose:
project_src: "{{ services.mastodon.volume_folder }}"
pull: true
restarted: true
state: present
- 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:
2023-07-11 20:02:21 +00:00
name: Clean Mastodon preview card data older than two weeks
cron_file: ansible_mastodon_clean_preview_cards
2023-07-11 20:52:59 +00:00
job: docker exec mastodon_web_1 tootctl preview_cards remove --days 14
special_time: daily
user: root
state: present