---
- name: Install Docker
  ansible.builtin.import_tasks: install.yaml

- name: Configure Docker
  ansible.builtin.import_tasks: configure.yaml

# This taskfile will set two facts that will be used in subsequent tasks:
# * _docker_swarm_needs_join: a boolean indicating whether the host needs to be joined to the swarm
#   or is already joined
# * _docker_swarm_manager: the inventory hostname of a swarm manager that can be delegated to to
#   fetch swarm joining info
- name: Check swarm state ahead of swarm configuration
  ansible.builtin.import_tasks: check.yaml

- name: Join server to swarm
  when: _docker_swarm_needs_join
  ansible.builtin.include_tasks: join.yaml

- name: Configure gluster storage driver
  ansible.builtin.import_tasks: gluster.yaml
