when: not mariadb_is_running and (hostvars[groups['infrastructure_nodes'][0]].mariadb_is_running or hostvars[groups['infrastructure_nodes'][1]].mariadb_is_running)
block:
- name: Start mariadb
ansible.builtin.command: systemctl start mariadb
- name: Start garbd
ansible.builtin.command: systemctl start garbd
- name: Bootstrap mariadb cluster
# If mariadb is not running on any node, we have to bootstrap
when: not mariadb_is_running and (not hostvars[groups['infrastructure_nodes'][0]].mariadb_is_running and not hostvars[groups['infrastructure_nodes'][1]].mariadb_is_running)
block:
# If mariadb tries to join a cluster but fails we can't just stop it, we have to kill it (otherwise we also can't bootstrap from scratch)