ansible-taler-exchange

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

main.yml (1375B)


      1 ---
      2 # service_facts lists services, not targets. Query systemd itself, including
      3 # timers and sockets which could reactivate a service during a migration.
      4 - name: Discover active systemd units
      5   ansible.builtin.command:
      6     argv:
      7       - systemctl
      8       - list-units
      9       - --state=active,activating,reloading,deactivating
     10       - --plain
     11       - --no-legend
     12       - --no-pager
     13   register: stop_services_systemd_units
     14   changed_when: false
     15   check_mode: false
     16 
     17 - name: Record application units to stop
     18   ansible.builtin.set_fact:
     19     stop_services_active_units: >-
     20       {{ stop_services_systemd_units.stdout_lines
     21          | map('split') | map('first')
     22          | select('match', '^(taler-exchange.*|taler-auditor.*|taler-helper-auditor.*|libeufin-nexus.*|challenger-httpd|sms-challenger-httpd|email-challenger-httpd|postal-challenger-httpd'
     23              ~ ('|taler-merchant.*' if stop_services_include_merchant | bool else '')
     24              ~ ')[.](service|target|timer|socket)$') | list }}
     25 
     26 - name: Stop application units without changing boot enablement
     27   ansible.builtin.systemd:
     28     name: "{{ item }}"
     29     state: stopped
     30   # Stop activation sources before the services they can start.
     31   loop: >-
     32     {{ (stop_services_active_units | select('search', '[.](timer|socket)$') | list)
     33        + (stop_services_active_units | reject('search', '[.](timer|socket)$') | list) }}