- removed dynamic building of the postgres db list an reused matrix_postgres_additional_databases in group_vars/matrix_servers as source for the list

- adjusted env-postgres-backup.j2 to use the new role specific variables
This commit is contained in:
foxcris 2021-03-16 10:49:04 +01:00
parent 604ffe7d79
commit 43f7d9afb6
5 changed files with 9 additions and 111 deletions

View File

@ -1419,6 +1419,8 @@ matrix_postgres_backup_connection_port: "{{ matrix_postgres_connection_port }}"
matrix_postgres_backup_connection_username: "{{ matrix_postgres_connection_username }}" matrix_postgres_backup_connection_username: "{{ matrix_postgres_connection_username }}"
matrix_postgres_backup_connection_password: "{{ matrix_postgres_connection_password }}" matrix_postgres_backup_connection_password: "{{ matrix_postgres_connection_password }}"
matrix_postgres_backup_db_list: "{{ matrix_postgres_additional_databases|map(attribute='name')|join(', ') }}"
###################################################################### ######################################################################
# #
# /matrix-postgres-backup # /matrix-postgres-backup

View File

@ -5,6 +5,8 @@ matrix_postgres_backup_connection_port: 5432
matrix_postgres_backup_connection_username: "matrix" matrix_postgres_backup_connection_username: "matrix"
matrix_postgres_backup_connection_password: "" matrix_postgres_backup_connection_password: ""
matrix_postgres_backup_db_list: ""
matrix_postgres_backup_extra_opts: "-Z9 --schema=public --blobs" matrix_postgres_backup_extra_opts: "-Z9 --schema=public --blobs"
matrix_postgres_backup_schedule: "@daily" matrix_postgres_backup_schedule: "@daily"
matrix_postgres_backup_keep_days: "7" matrix_postgres_backup_keep_days: "7"
@ -17,108 +19,6 @@ matrix_postgres_backup_path: "{{ matrix_base_data_path }}/postgres-backup"
matrix_postgres_base_path: "{{ matrix_base_data_path }}/postgres" matrix_postgres_base_path: "{{ matrix_base_data_path }}/postgres"
matrix_postgres_data_path: "{{ matrix_postgres_base_path }}/data" matrix_postgres_data_path: "{{ matrix_postgres_base_path }}/data"
# uses sqlite per default
matrix_postgres_backup_matrix_reminder_bot_enabled: false
matrix_bot_matrix_reminder_bot_database_name: 'matrix_reminder_bot'
# uses sqlite per default
matrix_postgres_backup_matrix_appservice_discord_enabled: false
matrix_appservice_discord_database_name: 'matrix_appservice_discord'
# uses nedb per default
matrix_postgres_backup_matrix_appservice_irc_enabled: false
matrix_appservice_irc_database_name: 'matrix_appservice_irc'
# uses nedb per default
matrix_postgres_backup_matrix_appservice_slack_enabled: false
matrix_appservice_slack_database_name: 'matrix_appservice_slack'
# uses postgres per default
matrix_postgres_backup_matrix_mautrix_facebook_enabled: false
matrix_mautrix_facebook_database_name: 'matrix_mautrix_facebook'
# uses sqlite per default
matrix_postgres_backup_matrix_mautrix_hangouts_enabled: false
matrix_mautrix_hangouts_database_name: 'matrix_mautrix_hangouts'
# uses postgres per default
matrix_postgres_backup_matrix_mautrix_signal_enabled: false
matrix_mautrix_signal_database_name: 'matrix_mautrix_signal'
# uses sqlite per default
matrix_postgres_backup_matrix_mautrix_telegram_enabled: false
matrix_mautrix_telegram_database_name: 'matrix_mautrix_telegram'
# uses sqlite per default
matrix_postgres_backup_matrix_mautrix_whatsapp_enabled: false
matrix_mautrix_whatsapp_database_name: 'matrix_mautrix_whatsapp'
# uses sqlite per default
matrix_postgres_backup_matrix_mx_puppet_discord_enabled: false
matrix_mx_puppet_discord_database_name: 'matrix_mx_puppet_discord'
# uses sqlite per default
matrix_postgres_backup_matrix_mx_puppet_instagram_enabled: false
matrix_postgres_backup_matrix_mx_puppet_instagram_name: 'matrix_mx_puppet_instagram'
# uses sqlite per default
matrix_postgres_backup_matrix_mx_puppet_skype_enabled: false
matrix_mx_puppet_skype_database_name: 'matrix_mx_puppet_skype'
# uses sqlite per default
matrix_postgres_backup_matrix_mx_puppet_slack_enabled: false
matrix_mx_puppet_slack_database_name: 'matrix_mx_puppet_slack'
# uses sqlite per default
matrix_postgres_backup_matrix_mx_puppet_steam_enabled: false
matrix_mx_puppet_steam_database_name: 'matrix_mx_puppet_steam'
# uses sqlite per default
matrix_postgres_backup_matrix_mx_puppet_twitter_enabled: false
matrix_mx_puppet_twitter_database_name: 'matrix_mx_puppet_twitter'
# uses sqlite per default
matrix_postgres_backup_matrix_dimension_enabled: false
matrix_dimension_database_name: 'matrix_dimension'
# uses sqlite per default
matrix_postgres_backup_matrix_etherpad_enabled: false
matrix_etherpad_database_name: 'matrix_etherpad'
# uses sqlite per default
matrix_postgres_backup_matrix_ma1sd_enabled: false
matrix_ma1sd_database_name: 'matrix_ma1sd'
# uses sqlite per default
matrix_postgres_backup_matrix_registration_enabled: false
matrix_registration_database_engine: 'matrix_registration'
# uses postgres per default
matrix_postgres_backup_matrix_synapse_enabled: true
matrix_postgres_db_name: 'matrix'
matrix_postgres_backup_db_dict:
- { enabled: '{{matrix_postgres_backup_matrix_reminder_bot_enabled|bool}}' , dbname: '{{ matrix_bot_matrix_reminder_bot_database_name }}' }
- { enabled: '{{matrix_postgres_backup_matrix_appservice_discord_enabled|bool}}' , dbname: '{{ matrix_appservice_discord_database_name }}' }
- { enabled: '{{matrix_postgres_backup_matrix_appservice_irc_enabled|bool}}' , dbname: '{{ matrix_appservice_irc_database_name }}' }
- { enabled: '{{matrix_postgres_backup_matrix_appservice_slack_enabled|bool}}' , dbname: '{{ matrix_appservice_slack_database_name }}' }
- { enabled: '{{matrix_postgres_backup_matrix_mautrix_facebook_enabled|bool}}' , dbname: '{{ matrix_mautrix_facebook_database_name }}' }
- { enabled: '{{matrix_postgres_backup_matrix_mautrix_hangouts_enabled|bool}}' , dbname: '{{ matrix_mautrix_hangouts_database_name }}' }
- { enabled: '{{matrix_postgres_backup_matrix_mautrix_signal_enabled|bool}}' , dbname: '{{ matrix_mautrix_signal_database_name }}' }
- { enabled: '{{matrix_postgres_backup_matrix_mautrix_telegram_enabled|bool}}' , dbname: '{{ matrix_mautrix_telegram_database_name }}' }
- { enabled: '{{matrix_postgres_backup_matrix_mautrix_whatsapp_enabled|bool}}' , dbname: '{{ matrix_mautrix_whatsapp_database_name }}' }
- { enabled: '{{matrix_postgres_backup_matrix_mx_puppet_instagram_enabled|bool}}' , dbname: '{{ matrix_postgres_backup_matrix_mx_puppet_instagram_name }}' }
- { enabled: '{{matrix_postgres_backup_matrix_mx_puppet_skype_enabled|bool}}' , dbname: '{{ matrix_mx_puppet_skype_database_name }}' }
- { enabled: '{{matrix_postgres_backup_matrix_mx_puppet_slack_enabled|bool}}' , dbname: '{{ matrix_mx_puppet_slack_database_name }}' }
- { enabled: '{{matrix_postgres_backup_matrix_mx_puppet_steam_enabled|bool}}' , dbname: '{{ matrix_mx_puppet_steam_database_name }}' }
- { enabled: '{{matrix_postgres_backup_matrix_mx_puppet_twitter_enabled|bool}}' , dbname: '{{ matrix_mx_puppet_twitter_database_name }}' }
- { enabled: '{{matrix_postgres_backup_matrix_dimension_enabled|bool}}' , dbname: '{{ matrix_dimension_database_name }}' }
- { enabled: '{{matrix_postgres_backup_matrix_etherpad_enabled|bool}}' , dbname: '{{ matrix_etherpad_database_name }}' }
- { enabled: '{{matrix_postgres_backup_matrix_ma1sd_enabled|bool}}' , dbname: '{{ matrix_ma1sd_database_name }}' }
- { enabled: '{{matrix_postgres_backup_matrix_registration_enabled|bool}}' , dbname: '{{ matrix_registration_database_engine }}' }
- { enabled: '{{matrix_postgres_backup_matrix_synapse_enabled|bool}}' , dbname: '{{ matrix_postgres_db_name }}' }
matrix_postgres_backup_architecture: amd64 matrix_postgres_backup_architecture: amd64
# matrix_postgres_docker_image_suffix controls whether we use Alpine-based images (`-alpine`) or the normal Debian-based images. # matrix_postgres_docker_image_suffix controls whether we use Alpine-based images (`-alpine`) or the normal Debian-based images.

View File

@ -3,7 +3,6 @@
# #
# Tasks related to setting up an internal postgres server # Tasks related to setting up an internal postgres server
# #
- import_tasks: "{{ role_path }}/tasks/util/detect_existing_postgres_version.yml" - import_tasks: "{{ role_path }}/tasks/util/detect_existing_postgres_version.yml"
when: matrix_postgres_enabled|bool when: matrix_postgres_enabled|bool
@ -34,10 +33,6 @@
- "{{ matrix_postgres_backup_path }}" - "{{ matrix_postgres_backup_path }}"
when: matrix_postgres_backup_enabled|bool when: matrix_postgres_backup_enabled|bool
#Build database list to backup
- import_tasks: "{{ role_path }}/tasks/build_database_list.yml"
when: matrix_postgres_backup_enabled|bool
- name: Ensure Postgres environment variables file created - name: Ensure Postgres environment variables file created
template: template:
src: "{{ role_path }}/templates/{{ item }}.j2" src: "{{ role_path }}/templates/{{ item }}.j2"

View File

@ -15,3 +15,4 @@
- "matrix_postgres_backup_keep_weeks" - "matrix_postgres_backup_keep_weeks"
- "matrix_postgres_backup_keep_months" - "matrix_postgres_backup_keep_months"
- "matrix_postgres_backup_path" - "matrix_postgres_backup_path"
- "matrix_postgres_backup_db_list"

View File

@ -1,7 +1,7 @@
#jinja2: lstrip_blocks: "True" #jinja2: lstrip_blocks: "True"
POSTGRES_USER={{ matrix_postgres_connection_username }} POSTGRES_USER={{ matrix_postgres_backup_connection_username }}
POSTGRES_PASSWORD={{ matrix_postgres_connection_password }} POSTGRES_PASSWORD={{ matrix_postgres_backup_connection_password }}
POSTGRES_HOST={{ matrix_postgres_connection_hostname }} POSTGRES_HOST={{ matrix_postgres_backup_connection_hostname }}
POSTGRES_DB={{ matrix_postgres_backup_db_list }} POSTGRES_DB={{ matrix_postgres_backup_db_list }}
POSTGRES_EXTRA_OPTS={{ matrix_postgres_backup_extra_opts }} POSTGRES_EXTRA_OPTS={{ matrix_postgres_backup_extra_opts }}
SCHEDULE={{ matrix_postgres_backup_schedule }} SCHEDULE={{ matrix_postgres_backup_schedule }}
@ -9,4 +9,4 @@ BACKUP_KEEP_DAYS={{ matrix_postgres_backup_keep_days }}
BACKUP_KEEP_WEEKS={{ matrix_postgres_backup_keep_weeks }} BACKUP_KEEP_WEEKS={{ matrix_postgres_backup_keep_weeks }}
BACKUP_KEEP_MONTHS={{ matrix_postgres_backup_keep_months }} BACKUP_KEEP_MONTHS={{ matrix_postgres_backup_keep_months }}
HEALTHCHECK_PORT={{ matrix_postgres_backup_healthcheck_port }} HEALTHCHECK_PORT={{ matrix_postgres_backup_healthcheck_port }}
POSTGRES_PORT={{ matrix_postgres_connection_port }} POSTGRES_PORT={{ matrix_postgres_backup_connection_port }}