commit 6627a79a4bbe90166864b0bfbc75f1a21a5811ff
parent b5abc2f3e2a1589ac342977ef53b574b75e7840a
Author: Devan Carpenter <devan@taler.net>
Date: Wed, 21 Aug 2024 17:56:30 -0500
split taler role into separate components
Diffstat:
9 files changed, 127 insertions(+), 35 deletions(-)
diff --git a/playbooks/play.yml b/playbooks/play.yml
@@ -5,4 +5,5 @@
- common_packages
- webserver
- database
- - taler
+ - taler-libeufin-nexus
+ - taler-exchange
diff --git a/roles/taler-exchange/tasks/main.yml b/roles/taler-exchange/tasks/main.yml
@@ -0,0 +1,23 @@
+---
+- name: Install Taler packages
+ apt:
+ name:
+ - taler-exchange
+ state: latest
+ update_cache: true
+ when: ansible_os_family == 'Debian'
+
+ #- name: Ensure config dir exists
+ # file:
+ # path: "/etc/taler"
+ # state: directory
+ #
+ #- name: Install the setup config
+ # template:
+ # src: taler-exchange.conf
+ # dest: "/etc/taler/taler.conf"
+
+- name: Setup Taler Exchange database
+ shell:
+ cmd: taler-exchange-dbconfig
+ chdir: /tmp
diff --git a/roles/taler/vars/main.yml b/roles/taler-exchange/vars/main.yml
diff --git a/roles/taler-libeufin-nexus/tasks/main.yml b/roles/taler-libeufin-nexus/tasks/main.yml
@@ -0,0 +1,33 @@
+---
+- name: Install Taler packages
+ apt:
+ name:
+ - libeufin-nexus
+ state: latest
+ update_cache: true
+ when: ansible_os_family == 'Debian'
+
+- name: Ensure config dir exists
+ file:
+ path: "/etc/libeufin"
+ state: directory
+
+- name: Install the setup config
+ template:
+ src: libeufin-nexus.conf
+ dest: "/etc/libeufin/libeufin-nexus.conf"
+
+- name: Setup libeufin-nexus database
+ shell:
+ cmd: libeufin-dbconfig --only-nexus
+ chdir: /tmp
+
+## Not working...
+#- name: Setup Taler libeufin-nexus
+# shell: libeufin-nexus ebics-setup -c /etc/libeufin/libeufin-nexus.conf
+
+#- name: Ensure correct file ownership
+# file:
+# path: /var/lib/libeufin-nexus/bank-ebics-keys.json
+# owner: libeufin-nexus
+# group: libeufin-nexus
diff --git a/roles/taler-libeufin-nexus/templates/libeufin-nexus.conf b/roles/taler-libeufin-nexus/templates/libeufin-nexus.conf
@@ -0,0 +1,19 @@
+[nexus-ebics]
+CURRENCY = CHF
+
+# Bank
+HOST_BASE_URL = http://example.com
+BANK_DIALECT = postfinance
+
+# EBICS IDs
+HOST_ID = PFEBICS
+USER_ID = PFC00563
+PARTNER_ID = PFC00563
+
+# Account information
+IBAN = CH7789144474425692816
+BIC = POFICHBEXXX
+NAME = John Smith S.A.
+
+[libeufin-nexusdb-postgres]
+config = postgres:///libeufin
diff --git a/roles/taler-libeufin-nexus/templates/setup-libeufin-nexus.sh b/roles/taler-libeufin-nexus/templates/setup-libeufin-nexus.sh
@@ -0,0 +1,50 @@
+#!/bin/bash
+# This file is in the public domain.
+#
+# This script configures libeufin-nexus.
+
+
+set -eu
+
+source functions.sh
+{ source <(./config.py 3>&1 >&4 4>&-); } 4>&1
+source config/internal.conf
+
+say "Beginning LibEuFin setup"
+
+if test -z "${BANK_NAME:-}"; then
+ say "Error: config/user.conf does not specify BANK_NAME"
+ exit 1
+fi
+if test -z "${DOMAIN_NAME:-}"; then
+ say "Error: config/user.conf does not specify DOMAIN_NAME"
+ exit 1
+fi
+if test -z "${BANK_ADMIN_PASSWORD:-}"; then
+ say "Error: config/user.conf does not specify BANK_ADMIN_PASSWORD"
+ exit 1
+fi
+if test -z "${BANK_EXCHANGE_PASSWORD:-}"; then
+ say "Error: config/user.conf does not specify BANK_EXCHANGE_PASSWORD"
+ exit 1
+fi
+
+if test ${DO_CONVERSION} == y; then
+ say "Configuring libeufin-nexus with ${FIAT_CURRENCY}..."
+
+ taler-harness config -c /etc/libeufin/libeufin-nexus.conf set \
+ nexus-ebics CURRENCY "$FIAT_CURRENCY"
+ taler-harness config -c /etc/libeufin/libeufin-nexus.conf set \
+ nexus-ebics IBAN "$FIAT_ACCOUNT_IBAN"
+ taler-harness config -c /etc/libeufin/libeufin-nexus.conf set \
+ nexus-ebics BIC "$FIAT_ACCOUNT_BIC"
+ taler-harness config -c /etc/libeufin/libeufin-nexus.conf set \
+ nexus-ebics NAME "$FIAT_ACCOUNT_NAME"
+fi
+
+
+say "Setting up libeufin database..."
+
+libeufin-dbconfig &>> setup.log
+
+say "LibEuFin setup finished"
diff --git a/roles/taler/templates/taler.conf b/roles/taler-libeufin-nexus/templates/taler.conf
diff --git a/roles/taler/vars/main.yml b/roles/taler-libeufin-nexus/vars/main.yml
diff --git a/roles/taler/tasks/main.yml b/roles/taler/tasks/main.yml
@@ -1,34 +0,0 @@
----
-- name: Install git
- apt:
- name:
- - git
- state: present
- update_cache: true
- when: ansible_os_family == 'Debian'
-
-- name: Checkout Taler deployment repo
- git:
- repo: 'https://git.taler.net/deployment.git'
- dest: /tmp/deployment
- version: master
-
-- name: Ensure config dir exists
- file:
- path: "/tmp/deployment/regional-currency/config"
- state: directory
-
-- name: Install the Taler config
- template:
- src: taler.conf
- dest: "/tmp/deployment/regional-currency/config/user.conf"
-
-- name: Setup Taler libeufin
- shell:
- cmd: bash -ex /tmp/deployment/regional-currency/setup-libeufin.sh
- chdir: /tmp/deployment/regional-currency
-
-- name: Setup Taler Exchange
- shell:
- cmd: bash -ex /tmp/deployment/regional-currency/setup-exchange.sh
- chdir: /tmp/deployment/regional-currency