You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
1.2 KiB

  1. ---
  2. - name: "Kubernetes Apps | Lay Down Heketi"
  3. become: true
  4. template:
  5. src: "heketi-deployment.json.j2"
  6. dest: "{{ kube_config_dir }}/heketi-deployment.json"
  7. register: "rendering"
  8. - name: "Kubernetes Apps | Install and configure Heketi"
  9. kube:
  10. name: "GlusterFS"
  11. kubectl: "{{ bin_dir }}/kubectl"
  12. filename: "{{ kube_config_dir }}/heketi-deployment.json"
  13. state: "{{ rendering.changed | ternary('latest', 'present') }}"
  14. - name: "Ensure heketi is up and running."
  15. changed_when: false
  16. register: "heketi_state"
  17. vars:
  18. heketi_state:
  19. stdout: "{}"
  20. pods_query: "items[?kind=='Pod'].status.conditions|[0][?type=='Ready'].status|[0]"
  21. deployments_query: "items[?kind=='Deployment'].status.conditions|[0][?type=='Available'].status|[0]"
  22. command: "{{ bin_dir }}/kubectl get deployments,pods --selector=glusterfs --output=json"
  23. until:
  24. - "heketi_state.stdout|from_json|json_query(pods_query) == 'True'"
  25. - "heketi_state.stdout|from_json|json_query(deployments_query) == 'True'"
  26. retries: 60
  27. delay: 5
  28. - name: Set the Heketi pod name
  29. set_fact:
  30. heketi_pod_name: "{{ heketi_state.stdout|from_json|json_query(\"items[?kind=='Pod'].metadata.name|[0]\") }}"