Allow username of additional Postgres databases to be different

We'll most likely use one that matches the database name, but
it's better to have it configurable.
This commit is contained in:
Slavi Pantaleev 2020-12-13 21:43:53 +02:00
parent 527d5f57d5
commit 0641106370
3 changed files with 22 additions and 5 deletions

View File

@ -893,62 +893,77 @@ matrix_postgres_additional_databases: |
{{ {{
([{ ([{
name: 'matrix_appservice_discord', name: 'matrix_appservice_discord',
username: 'matrix_appservice_discord',
pass: matrix_synapse_macaroon_secret_key | password_hash('sha512', 'app_discord.db.secret') | string pass: matrix_synapse_macaroon_secret_key | password_hash('sha512', 'app_discord.db.secret') | string
}] if matrix_appservice_discord_enabled else []) }] if matrix_appservice_discord_enabled else [])
+ ([{ + ([{
name: 'matrix_appservice_slack' name: 'matrix_appservice_slack'
username: 'matrix_appservice_slack',
pass: matrix_synapse_macaroon_secret_key | password_hash('sha512', 'app_slack.db.secret') | string pass: matrix_synapse_macaroon_secret_key | password_hash('sha512', 'app_slack.db.secret') | string
}] if matrix_appservice_slack_enabled else []) }] if matrix_appservice_slack_enabled else [])
+ ([{ + ([{
name: 'matrix_appservice_irc' name: 'matrix_appservice_irc'
username: 'matrix_appservice_irc',
pass: matrix_synapse_macaroon_secret_key | password_hash('sha512', 'app_irc.db.secret') | string pass: matrix_synapse_macaroon_secret_key | password_hash('sha512', 'app_irc.db.secret') | string
}] if matrix_appservice_irc_enabled else []) }] if matrix_appservice_irc_enabled else [])
+ ([{ + ([{
name: 'mautrix-bridge-facebook' name: 'mautrix_bridge_facebook'
username: 'mautrix_bridge_facebook',
pass: matrix_synapse_macaroon_secret_key | password_hash('sha512', 'mautrix_facebook.db.secret') | string pass: matrix_synapse_macaroon_secret_key | password_hash('sha512', 'mautrix_facebook.db.secret') | string
}] if matrix_mautrix_facebook_enabled else []) }] if matrix_mautrix_facebook_enabled else [])
+ ([{ + ([{
name: 'mautrix_bridge_hangouts' name: 'mautrix_bridge_hangouts'
username: 'mautrix_bridge_hangouts',
pass: matrix_synapse_macaroon_secret_key | password_hash('sha512', 'mautrix_hangouts.db.secret') | string pass: matrix_synapse_macaroon_secret_key | password_hash('sha512', 'mautrix_hangouts.db.secret') | string
}] if matrix_mautrix_hangouts_enabled else []) }] if matrix_mautrix_hangouts_enabled else [])
+ ([{ + ([{
name: 'mautrix_bridge_telegram' name: 'mautrix_bridge_telegram'
username: 'mautrix_bridge_telegram',
pass: matrix_synapse_macaroon_secret_key | password_hash('sha512', 'mautrix_telegram.db.secret') | string pass: matrix_synapse_macaroon_secret_key | password_hash('sha512', 'mautrix_telegram.db.secret') | string
}] if matrix_mautrix_telegram_enabled else []) }] if matrix_mautrix_telegram_enabled else [])
+ ([{ + ([{
name: 'mautrix_bridge_whatsapp' name: 'mautrix_bridge_whatsapp'
username: 'mautrix_bridge_whatsapp',
pass: matrix_synapse_macaroon_secret_key | password_hash('sha512', 'mautrix_whatsapp.db.secret') | string pass: matrix_synapse_macaroon_secret_key | password_hash('sha512', 'mautrix_whatsapp.db.secret') | string
}] if matrix_mautrix_whatsapp_enabled else []) }] if matrix_mautrix_whatsapp_enabled else [])
+ ([{ + ([{
name: 'matrix_bridge_sms' name: 'matrix_bridge_sms'
username: 'matrix_bridge_sms',
pass: matrix_synapse_macaroon_secret_key | password_hash('sha512', 'bridge_sms.db.secret') | string pass: matrix_synapse_macaroon_secret_key | password_hash('sha512', 'bridge_sms.db.secret') | string
}] if matrix_sms_bridge_enabled else []) }] if matrix_sms_bridge_enabled else [])
+ ([{ + ([{
name: 'matrix_puppet_skype' name: 'matrix_puppet_skype'
username: 'matrix_puppet_skype',
pass: matrix_synapse_macaroon_secret_key | password_hash('sha512', 'mx_skype.db.secret') | string pass: matrix_synapse_macaroon_secret_key | password_hash('sha512', 'mx_skype.db.secret') | string
}] if matrix_mx_puppet_skype_enabled else []) }] if matrix_mx_puppet_skype_enabled else [])
+ ([{ + ([{
name: 'matrix_puppet_slack' name: 'matrix_puppet_slack'
username: 'matrix_puppet_slack',
pass: matrix_synapse_macaroon_secret_key | password_hash('sha512', 'mx_slack.db.secret') | string pass: matrix_synapse_macaroon_secret_key | password_hash('sha512', 'mx_slack.db.secret') | string
}] if matrix_mx_puppet_slack_enabled else []) }] if matrix_mx_puppet_slack_enabled else [])
+ ([{ + ([{
name: 'matrix_puppet_twitter' name: 'matrix_puppet_twitter'
username: 'matrix_puppet_twitter',
pass: matrix_synapse_macaroon_secret_key | password_hash('sha512', 'mx_twitter.db.secret') | string pass: matrix_synapse_macaroon_secret_key | password_hash('sha512', 'mx_twitter.db.secret') | string
}] if matrix_mx_puppet_twitter_enabled else []) }] if matrix_mx_puppet_twitter_enabled else [])
+ ([{ + ([{
name: 'matrix_puppet_instagram' name: 'matrix_puppet_instagram'
username: 'matrix_puppet_instagram',
pass: matrix_synapse_macaroon_secret_key | password_hash('sha512', 'mx_insta.db.secret') | string pass: matrix_synapse_macaroon_secret_key | password_hash('sha512', 'mx_insta.db.secret') | string
] if matrix_mx_puppet_instagram_enabled else []) ] if matrix_mx_puppet_instagram_enabled else [])
+ ([{ + ([{
name: 'matrix_puppet_discord' name: 'matrix_puppet_discord'
username: 'matrix_puppet_discord',
pass: matrix_synapse_macaroon_secret_key | password_hash('sha512', 'mx_puppet.db.secret') | string pass: matrix_synapse_macaroon_secret_key | password_hash('sha512', 'mx_puppet.db.secret') | string
}] if matrix_mx_puppet_discord_enabled else []) }] if matrix_mx_puppet_discord_enabled else [])
+ ([{ + ([{
name: 'matrix_puppet_steam' name: 'matrix_puppet_steam'
username: 'matrix_puppet_steam',
pass: matrix_synapse_macaroon_secret_key | password_hash('sha512', 'mx_steam.db.secret') | string pass: matrix_synapse_macaroon_secret_key | password_hash('sha512', 'mx_steam.db.secret') | string
}] if matrix_mx_puppet_steam_enabled else []) }] if matrix_mx_puppet_steam_enabled else [])
+ ([{ + ([{
name: 'matrix_dimension' name: 'matrix_dimension'
username: 'matrix_dimension',
pass: matrix_synapse_macaroon_secret_key | password_hash('sha512', 'dimension.db.secret') | string pass: matrix_synapse_macaroon_secret_key | password_hash('sha512', 'dimension.db.secret') | string
}] if matrix_dimension_enabled else []) }] if matrix_dimension_enabled else [])
}} }}

View File

@ -36,7 +36,9 @@ matrix_postgres_container_postgres_bind_port: ""
# Example: # Example:
# matrix_postgres_additional_databases: # matrix_postgres_additional_databases:
# - name: matrix_appservice_discord # - name: matrix_appservice_discord
# pass: some-password # username: matrix_appservice_discord
# pass: some_password
# - name: matrix_appservice_slack # - name: matrix_appservice_slack
# pass: some-password # username: matrix_appservice_slack
# pass: some_password
matrix_postgres_additional_databases: [] matrix_postgres_additional_databases: []

View File

@ -6,7 +6,7 @@
- name: Create additional users in postgres - name: Create additional users in postgres
postgresql_user: postgresql_user:
name: "{{ item.name }}" name: "{{ item.username }}"
password: "{{ item.pass }}" password: "{{ item.pass }}"
login_host: "{{ matrix_postgres_container_ip.stdout }}" login_host: "{{ matrix_postgres_container_ip.stdout }}"
login_port: 5432 login_port: 5432
@ -18,7 +18,7 @@
- name: Create additional users in postgres - name: Create additional users in postgres
postgresql_db: postgresql_db:
name: "{{ item.name }}" name: "{{ item.name }}"
owner: "{{ item.name }}" owner: "{{ item.username }}"
lc_ctype: 'C' lc_ctype: 'C'
lc_collate: 'C' lc_collate: 'C'
login_host: "{{ matrix_postgres_container_ip.stdout }}" login_host: "{{ matrix_postgres_container_ip.stdout }}"