swarm_attempt.ymlΒΆ

---
- name: "🧹 Matomo bootstrap | Swarm: reset wedged state before retry"
  ansible.builtin.include_tasks:
    file: ../../utils/reset_state.yml
    apply:
      delegate_to: "{{ MATOMO_HOST_NODE }}"
  when:
    - IS_STACK_HOST | bool
    - matomo_attempt_index | int > 0
    - (matomo_install_state.stdout | trim) != 'installed'
    - ((matomo_bootstrap_swarm | default({})).rc | default(1)) | int != 0

- name: "🐝 Matomo bootstrap | Swarm: force installer run and wait for its token"
  ansible.builtin.script: "{{ role_path }}/files/shell/bootstrap_swarm_poll.sh"
  environment:
    SERVICE_REF: "{{ lookup('container_service', application_id, MATOMO_BOOTSTRAP_SERVICE) }}"
    DEADLINE_S: "{{ MATOMO_INSTALLER_STEP_DEADLINE_S | int }}"
    POLL_DELAY_S: "{{ MATOMO_BOOTSTRAP_SWARM_POLL_DELAY_S | int }}"
  register: matomo_bootstrap_attempt
  changed_when: true
  failed_when: false
  no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}"
  when: ((matomo_bootstrap_swarm | default({})).rc | default(1)) | int != 0

- name: "🎯 Matomo bootstrap | Swarm: record attempt result"
  ansible.builtin.set_fact:
    matomo_bootstrap_swarm: "{{ matomo_bootstrap_attempt }}"
  no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}"
  when: matomo_bootstrap_attempt is not skipped