diff --git a/roles/docker/defaults/main.yml b/roles/docker/defaults/main.yml index 4ca41b0..1f34ddb 100644 --- a/roles/docker/defaults/main.yml +++ b/roles/docker/defaults/main.yml @@ -80,7 +80,7 @@ services: file: gitea.yml domain: "git.{{ base_domain }}" volume_folder: "{{ volume_root_folder }}/gitea" - version: 1.18 + version: "1.20" allowed_sender_domain: true passit: @@ -110,7 +110,7 @@ services: file: privatebin.yml domain: "paste.{{ base_domain }}" volume_folder: "{{ volume_root_folder }}/privatebin" - version: 20221009 + version: "20221009" codimd: file: codimd.yml @@ -174,11 +174,11 @@ services: file: drone.yml domain: "drone.{{ base_domain }}" volume_folder: "{{ volume_root_folder }}/drone" - version: 1 + version: "1" mailu: file: mailu.yml - version: 1.9 + version: "1.9" domain: "mail.{{ base_domain }}" dns: 192.168.203.254 subnet: 192.168.203.0/24 @@ -218,4 +218,4 @@ services: watchtower: file: watchtower.yml - version: amd64-1.5.3 + version: "1.5.3" diff --git a/roles/docker/tasks/services/mastodon.yml b/roles/docker/tasks/services/mastodon.yml index b6a623e..38f94a9 100644 --- a/roles/docker/tasks/services/mastodon.yml +++ b/roles/docker/tasks/services/mastodon.yml @@ -1,18 +1,33 @@ # vim: ft=yaml.ansible --- -- name: create mastodon volume folders +- name: Create volume folder for Mastodon data file: - name: "{{ services.mastodon.volume_folder }}/{{ volume }}" + name: "{{ services.mastodon.volume_folder }}/mastodon_data" state: directory owner: "991" - group: "991" - loop: - - "postgres_data" - - "postgres_config" - - "redis_data" - - "mastodon_data" - loop_control: - loop_var: volume + 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 - name: Copy mastodon environment file template: @@ -187,3 +202,21 @@ external: true internal_network: internal: true + +- 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 diff --git a/roles/docker/tasks/services/matrix_element.yml b/roles/docker/tasks/services/matrix_element.yml index 604bba6..f65aa2d 100644 --- a/roles/docker/tasks/services/matrix_element.yml +++ b/roles/docker/tasks/services/matrix_element.yml @@ -82,6 +82,7 @@ networks: - matrix - external_services + - postfix volumes: - "{{ services.matrix.volume_folder }}/data:/data" environment: @@ -113,5 +114,7 @@ external_services: external: name: external_services + postfix: + external: true matrix: name: "matrix" diff --git a/roles/docker/templates/matrix.homeserver.yaml.j2 b/roles/docker/templates/matrix.homeserver.yaml.j2 index b474901..6c6714e 100644 --- a/roles/docker/templates/matrix.homeserver.yaml.j2 +++ b/roles/docker/templates/matrix.homeserver.yaml.j2 @@ -820,23 +820,10 @@ password_config: # If your SMTP server requires authentication, the optional smtp_user & # smtp_pass variables should be used # -#email: -# enable_notifs: false -# smtp_host: "localhost" -# smtp_port: 25 -# smtp_user: "exampleusername" -# smtp_pass: "examplepassword" -# require_transport_security: False -# notif_from: "Your Friendly %(app)s Home Server " -# app_name: Matrix -# # if template_dir is unset, uses the example templates that are part of -# # the Synapse distribution. -# #template_dir: res/templates -# notif_template_html: notif_mail.html -# notif_template_text: notif_mail.txt -# notif_for_new_users: True -# riot_base_url: "http://localhost/riot" - +email: + smtp_host: "{{ smtp_host }}" + smtp_port: {{ smtp_port }} + notif_from: "{{ services.matrix.domain }} " #password_providers: # - module: "ldap_auth_provider.LdapAuthProvider"