commit f228915444d59bfd31c59558af59a6816389f05a
parent cf102fb81ef4aa4054f460a42d96c6f018288e38
Author: Florian Dold <dold@taler.net>
Date: Fri, 31 Jul 2026 15:42:38 +0200
reset sanction check progress on import and clean up the list
Without --reset the tool only looks at records added since the last run,
so a newly imported list was never applied to the accounts that already
existed. taler-exchange-sanctionscheck(1) documents --reset as the option
to use exactly when a new list is imported.
The imported list was also left in /tmp forever, because the cleanup task
was commented out; run it from an "always" block so it happens even when
the check fails.
Diffstat:
1 file changed, 21 insertions(+), 17 deletions(-)
diff --git a/roles/exchange-sanctionlist-import/tasks/main.yml b/roles/exchange-sanctionlist-import/tasks/main.yml
@@ -3,6 +3,7 @@
ansible.builtin.command:
cmd: "date +%F"
register: today
+ changed_when: false
- name: Create temporary file as destination for the import
ansible.builtin.tempfile:
@@ -11,21 +12,24 @@
suffix: .xml
register: importfile
-- name: Push file to local system
- copy:
- src: "{{ SANCTION_LIST }}"
- dest: "{{ importfile.path }}"
- owner: taler-exchange-httpd
- mode: "400"
+- name: Import and check the sanction list
+ block:
+ - name: Push file to local system
+ copy:
+ src: "{{ SANCTION_LIST }}"
+ dest: "{{ importfile.path }}"
+ owner: taler-exchange-httpd
+ mode: "0400"
-- name: Check sanction list
- ansible.builtin.command:
- cmd: "taler-exchange-sanctionscheck -- {{ EXCHANGE_SANCTION_HELPER }} {{ importfile.path }}"
- become: true
- become_user: taler-exchange-httpd
-
-# - name: Remove the temporary file on the server
-# ansible.builtin.file:
-# path: "{{ importfile.path }}"
-# state: absent
-# when: importfile.path is defined
+ # --reset makes the tool go over all historic records again, which is
+ # the point of importing a new list.
+ - name: Check sanction list
+ ansible.builtin.command:
+ cmd: "taler-exchange-sanctionscheck --reset -- {{ EXCHANGE_SANCTION_HELPER }} {{ importfile.path }}"
+ become: true
+ become_user: taler-exchange-httpd
+ always:
+ - name: Remove the temporary file on the server
+ ansible.builtin.file:
+ path: "{{ importfile.path }}"
+ state: absent