2022-12-29 21:13:31 +00:00
|
|
|
# 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
|
2023-09-30 14:25:06 +00:00
|
|
|
dest: "{{ services.mastodon.volume_folder }}/mastodon.env"
|
2022-05-07 20:53:18 +00:00
|
|
|
|
2023-09-30 14:25:06 +00:00
|
|
|
- name: Upload vhost config for Mastodon domain
|
2023-07-09 18:27:32 +00:00
|
|
|
copy:
|
2023-07-09 19:08:42 +00:00
|
|
|
src: vhost/mastodon
|
2022-11-26 08:15:18 +00:00
|
|
|
dest: "{{ services.nginx_proxy.volume_folder }}/vhost/{{ services.mastodon.domain }}"
|
2022-05-07 20:53:18 +00:00
|
|
|
|
2022-12-04 21:45:32 +00:00
|
|
|
- name: Copy PostgreSQL config
|
2022-12-02 22:10:15 +00:00
|
|
|
copy:
|
2023-07-09 18:27:32 +00:00
|
|
|
src: mastodon/postgresql.conf
|
2022-12-04 21:45:32 +00:00
|
|
|
dest: "{{ services.mastodon.volume_folder }}/postgres_config/postgresql.conf"
|
2022-12-02 22:10:15 +00:00
|
|
|
|
2023-09-30 14:25:06 +00:00
|
|
|
- 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:
|
2023-09-30 14:25:06 +00:00
|
|
|
project_src: "{{ services.mastodon.volume_folder }}"
|
2022-12-04 21:45:32 +00:00
|
|
|
pull: true
|
2022-12-04 21:55:00 +00:00
|
|
|
restarted: true
|
2023-09-30 14:25:06 +00:00
|
|
|
state: present
|
2023-07-11 19:56:04 +00:00
|
|
|
|
|
|
|
- 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
|
2023-07-11 19:56:04 +00:00
|
|
|
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
|
2023-07-11 19:56:04 +00:00
|
|
|
special_time: daily
|
|
|
|
user: root
|
|
|
|
state: present
|