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.

26 lines
1.3 KiB

  1. ---
  2. - name: "Get heketi topology."
  3. register: "heketi_topology"
  4. changed_when: false
  5. command: "{{ bin_dir }}/kubectl exec {{ heketi_pod_name }} -- heketi-cli --user admin --secret {{ heketi_admin_key }} topology info --json"
  6. - name: "Render heketi topology template."
  7. become: true
  8. vars: { nodes: "{{ groups['heketi-node'] }}" }
  9. register: "rendering"
  10. template:
  11. src: "topology.json.j2"
  12. dest: "{{ kube_config_dir }}/topology.json"
  13. mode: 0644
  14. - name: "Copy topology configuration into container." # noqa 503
  15. when: "rendering.changed"
  16. command: "{{ bin_dir }}/kubectl cp {{ kube_config_dir }}/topology.json {{ heketi_pod_name }}:/tmp/topology.json"
  17. - name: "Load heketi topology." # noqa 503
  18. when: "rendering.changed"
  19. command: "{{ bin_dir }}/kubectl exec {{ heketi_pod_name }} -- heketi-cli --user admin --secret {{ heketi_admin_key }} topology load --json=/tmp/topology.json"
  20. - name: "Get heketi topology."
  21. register: "heketi_topology"
  22. changed_when: false
  23. command: "{{ bin_dir }}/kubectl exec {{ heketi_pod_name }} -- heketi-cli --user admin --secret {{ heketi_admin_key }} topology info --json"
  24. until: "heketi_topology.stdout|from_json|json_query(\"clusters[*].nodes[*].devices[?state=='online'].id\")|flatten|length == groups['heketi-node']|length"
  25. retries: 60
  26. delay: 5