taler-deployment

Deployment scripts and configuration files
Log | Files | Refs | README

identity.yml (4432B)


      1 ---
      2 - name: Check for a recorded deployment identity
      3   ansible.builtin.stat:
      4     path: "{{ regional_currency_state_directory }}/deployment-identity.json"
      5   register: regional_currency_identity_file
      6 
      7 - name: Read the recorded deployment identity
      8   ansible.builtin.slurp:
      9     src: "{{ regional_currency_state_directory }}/deployment-identity.json"
     10   register: regional_currency_identity_data
     11   when: regional_currency_identity_file.stat.exists
     12 
     13 - name: Decode the recorded deployment identity
     14   ansible.builtin.set_fact:
     15     regional_currency_recorded_identity: "{{ regional_currency_identity_data.content | b64decode | from_json }}"
     16   when: regional_currency_identity_file.stat.exists
     17 
     18 - name: Reject incompatible deployment identity changes
     19   ansible.builtin.assert:
     20     that:
     21       - regional_currency_recorded_identity.currency == regional_currency_currency
     22       - regional_currency_recorded_identity.domain == regional_currency_domain
     23       - not regional_currency_recorded_identity.conversion_enabled or regional_currency_enable_conversion
     24       - >-
     25         not regional_currency_recorded_identity.conversion_enabled
     26         or regional_currency_recorded_identity.fiat_currency == regional_currency_fiat_currency
     27       - >-
     28         not regional_currency_recorded_identity.conversion_enabled
     29         or regional_currency_recorded_identity.fiat_account_iban == regional_currency_fiat_account_iban
     30       - >-
     31         not regional_currency_recorded_identity.conversion_enabled
     32         or regional_currency_recorded_identity.fiat_account_bic == regional_currency_fiat_account_bic
     33       - >-
     34         not regional_currency_recorded_identity.conversion_enabled
     35         or regional_currency_recorded_identity.fiat_account_name == regional_currency_fiat_account_name
     36     fail_msg: >-
     37       The inventory changes the deployed currency, domain, or established fiat-conversion identity.
     38       Those values require a separately planned migration and cannot be reconciled in place.
     39   when: regional_currency_identity_file.stat.exists
     40 
     41 - name: Check for an exchange configuration predating identity tracking
     42   ansible.builtin.stat:
     43     path: /etc/taler-exchange/conf.d/setup.conf
     44   register: regional_currency_legacy_exchange_config
     45   when: not regional_currency_identity_file.stat.exists
     46 
     47 - name: Read the legacy exchange currency
     48   ansible.builtin.command:
     49     argv:
     50       - taler-exchange-config
     51       - -s
     52       - exchange
     53       - -o
     54       - CURRENCY
     55   register: regional_currency_legacy_exchange_currency
     56   changed_when: false
     57   when:
     58     - not regional_currency_identity_file.stat.exists
     59     - regional_currency_legacy_exchange_config.stat.exists
     60 
     61 - name: Read the legacy exchange base URL
     62   ansible.builtin.command:
     63     argv:
     64       - taler-exchange-config
     65       - -s
     66       - exchange
     67       - -o
     68       - BASE_URL
     69   register: regional_currency_legacy_exchange_base_url
     70   changed_when: false
     71   when:
     72     - not regional_currency_identity_file.stat.exists
     73     - regional_currency_legacy_exchange_config.stat.exists
     74 
     75 - name: Check for a persisted legacy exchange payto URI
     76   ansible.builtin.stat:
     77     path: "{{ regional_currency_state_directory }}/exchange-payto"
     78   register: regional_currency_legacy_exchange_payto_file
     79   when: not regional_currency_identity_file.stat.exists
     80 
     81 - name: Read the persisted legacy exchange payto URI
     82   ansible.builtin.slurp:
     83     src: "{{ regional_currency_state_directory }}/exchange-payto"
     84   register: regional_currency_legacy_exchange_payto_data
     85   when:
     86     - not regional_currency_identity_file.stat.exists
     87     - regional_currency_legacy_exchange_payto_file.stat.exists
     88 
     89 - name: Verify the legacy deployment identity before adoption
     90   ansible.builtin.assert:
     91     that:
     92       - (regional_currency_legacy_exchange_currency.stdout | trim) == regional_currency_currency
     93       - (regional_currency_legacy_exchange_base_url.stdout | trim) == regional_currency_exchange_base_url
     94       - >-
     95         not regional_currency_legacy_exchange_payto_file.stat.exists
     96         or ('bank.' ~ regional_currency_domain) in
     97            (regional_currency_legacy_exchange_payto_data.content | b64decode | trim)
     98     fail_msg: >-
     99       Existing regional-currency state does not match this inventory. Restore the original identity
    100       values or perform a separately planned migration before running this role.
    101   when:
    102     - not regional_currency_identity_file.stat.exists
    103     - regional_currency_legacy_exchange_config.stat.exists