---
# glusterfs_check_containerized is a custom module defined at
# lib_utils/library/glusterfs_check_containerized.py
- name: GlusterFS cluster health time warning
  debug:
    msg: "Depending on the number of volumes in the cluster and their size, this might take few minutes to a couple of hours"

- name: Check for GlusterFS cluster health
  glusterfs_check_containerized:
    oc_bin: "{{ hostvars[groups.oo_first_master.0]['first_master_client_binary'] }}"
    oc_conf: "{{ openshift.common.config_base }}/master/admin.kubeconfig"
    oc_namespace: "{{ glusterfs_namespace }}"
    cluster_name: "{{ glusterfs_name }}"
    exclude_node: "{{ openshift.common.hostname }}"
    target_nodes: "{{ l_node_names | default(omit) }}"
    check_bricks: "{{ l_check_bricks | default(false) }}"
  delegate_to: "{{ groups.oo_first_master.0 }}"
  retries: "{{ (glusterfs_health_timeout | int / 10) | int }}"
  delay: 10
  register: glusterfs_check_containerized_res
  until: glusterfs_check_containerized_res is succeeded
