ansible-taler-exchange

Ansible playbook to deploy a production Taler Exchange
Log | Files | Refs | Submodules | README | LICENSE

commit 747d34208350329ae2574520439c8a2750160778
parent e1f52a204cff9fa16d51b1069101b2859b755df7
Author: Florian Dold <florian@dold.me>
Date:   Fri,  3 Jul 2026 16:57:30 +0200

only restore from backup when explicitly required

We also call it ENABLE_RESTORE_BACKUP now to avoid confusing double
negation.

Diffstat:
Minventories/group_vars/all/defaults.yml | 12++++++++++--
Minventories/host_vars/fdold-acai-gls/test-public.yml | 4++--
Minventories/host_vars/fdold-acai-tops/test-public.yml | 7-------
Minventories/host_vars/fdold-guava-glsint/test-public.yml | 7-------
Minventories/host_vars/rusty/vars.yml | 7-------
Minventories/host_vars/spec/vars.yml | 7-------
Minventories/host_vars/taler-gls-test-01/config.yml | 7-------
Mroles/database/tasks/main.yml | 4+++-
8 files changed, 15 insertions(+), 40 deletions(-)

diff --git a/inventories/group_vars/all/defaults.yml b/inventories/group_vars/all/defaults.yml @@ -36,4 +36,13 @@ nexus_domain: "nexus.{{ domain_name }}" # Use letsencrypt by default exchange_use_letsencrypt: true -nexus_use_letsencrypt: true -\ No newline at end of file +nexus_use_letsencrypt: true + +# Enable restore from backup? MUST be set to "false" in production, +# unless restoring from backup. +# Note that we do not restore backups if a database already exists at +# the target server. +# If no database exists on the target system and this option is 'true', +# then a backup must have been provided at the originating host +# (you get get it using the 'restore.sh' script). +ENABLE_RESTORE_BACKUP: false diff --git a/inventories/host_vars/fdold-acai-gls/test-public.yml b/inventories/host_vars/fdold-acai-gls/test-public.yml @@ -17,8 +17,8 @@ domain_name: "glstest.taler.net" DEPLOYMENT_KIND: "gls" # Our internal hostname TARGET_HOST_NAME: "acai.box.fdold.eu" -# Disable restore from backup? MUST be set to "false" once in production! -# This forces a backup to be provided *if* there is no database on the +# Enable restore from backup? MUST be set to "false" once in production! +# Enabling this a backup to be provided *if* there is no database on the # target system already. If such a database exists, we will NOT restore # any backup even if this is 'false'. If no database exists on the target # system and this option is 'false', then a backup must have been provided diff --git a/inventories/host_vars/fdold-acai-tops/test-public.yml b/inventories/host_vars/fdold-acai-tops/test-public.yml @@ -8,13 +8,6 @@ domain_name: "topstest.fdold.eu" exchange_domain: "exchange.{{ domain_name }}" # Our internal hostname TARGET_HOST_NAME: "acai.box.fdold.eu" -# Disable restore from backup? MUST be set to "false" once in production! -# This forces a backup to be provided *if* there is no database on the -# target system already. If such a database exists, we will NOT restore -# any backup even if this is 'false'. If no database exists on the target -# system and this option is 'false', then a backup must have been provided -# at the originating host (you get get it using the 'restore.sh' script). -DISABLE_RESTORE_BACKUP: true # Use nightly Taler distro (true/false). USE_NIGHTLY: true # Deploy EBICS configuration (true/false). diff --git a/inventories/host_vars/fdold-guava-glsint/test-public.yml b/inventories/host_vars/fdold-guava-glsint/test-public.yml @@ -18,13 +18,6 @@ exchange_domain: "exchange.{{ domain_name }}" DEPLOYMENT_KIND: "gls" # Our internal hostname TARGET_HOST_NAME: "guava.box.fdold.eu" -# Disable restore from backup? MUST be set to "false" once in production! -# This forces a backup to be provided *if* there is no database on the -# target system already. If such a database exists, we will NOT restore -# any backup even if this is 'false'. If no database exists on the target -# system and this option is 'false', then a backup must have been provided -# at the originating host (you get get it using the 'restore.sh' script). -DISABLE_RESTORE_BACKUP: true # Use nightly Taler distro (true/false). USE_NIGHTLY: false # Our currency. diff --git a/inventories/host_vars/rusty/vars.yml b/inventories/host_vars/rusty/vars.yml @@ -3,13 +3,6 @@ DEPLOYMENT_KIND: "tops" # Public variables for a "test" deployment # Deploy challenger? deploy_challenger: true -# Disable restore from backup? MUST be set to "false" once in production! -# This forces a backup to be provided *if* there is no database on the -# target system already. If such a database exists, we will NOT restore -# any backup even if this is 'false'. If no database exists on the target -# system and this option is 'false', then a backup must have been provided -# at the originating host (you get get it using the 'restore.sh' script). -DISABLE_RESTORE_BACKUP: true # Main external domain name. domain_name: "stage.taler-ops.ch" # Our internal hostname diff --git a/inventories/host_vars/spec/vars.yml b/inventories/host_vars/spec/vars.yml @@ -3,13 +3,6 @@ deploy_challenger: true # What kind of environment are we deploying? DEPLOYMENT_KIND: "tops" -# Disable restore from backup? MUST be set to "false" once in production! -# This forces a backup to be provided *if* there is no database on the -# target system already. If such a database exists, we will NOT restore -# any backup even if this is 'false'. If no database exists on the target -# system and this option is 'false', then a backup must have been provided -# at the originating host (you get get it using the 'restore.sh' script). -DISABLE_RESTORE_BACKUP: false # Use EBICS? (starts libeufin-nexus-fetch/submit services) USE_EBICS: false # Write EBICS configuration (with values in secret config) diff --git a/inventories/host_vars/taler-gls-test-01/config.yml b/inventories/host_vars/taler-gls-test-01/config.yml @@ -18,13 +18,6 @@ exchange_domain: "test.exchange.gls.de" DEPLOYMENT_KIND: "gls" # Our internal hostname TARGET_HOST_NAME: "test.exchange.gls.de" -# Disable restore from backup? MUST be set to "false" once in production! -# This forces a backup to be provided *if* there is no database on the -# target system already. If such a database exists, we will NOT restore -# any backup even if this is 'false'. If no database exists on the target -# system and this option is 'false', then a backup must have been provided -# at the originating host (you get get it using the 'restore.sh' script). -DISABLE_RESTORE_BACKUP: true # Use nightly Taler distro (true/false). USE_NIGHTLY: false # Our currency. diff --git a/roles/database/tasks/main.yml b/roles/database/tasks/main.yml @@ -60,7 +60,7 @@ - name: Fail if trying to import backup and versioning schema exists fail: msg="Backup for import provided, but _v schema exists on target host" when: - - not DISABLE_RESTORE_BACKUP + - ENABLE_RESTORE_BACKUP - versioning_schema_exists | default(false) | bool - local_backup_exists | bool @@ -74,6 +74,7 @@ group: postgres mode: "0400" when: + - ENABLE_RESTORE_BACKUP - local_backup_exists | bool - name: Restore PostgreSQL database from backup @@ -81,6 +82,7 @@ become_user: postgres shell: "gunzip -c /tmp/postgres-backup.sql.gz | psql -X -d postgres" when: + - ENABLE_RESTORE_BACKUP - local_backup_exists | bool - name: Remove backup from server (delete file)