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.

44 lines
1.7 KiB

  1. ---
  2. - name: Get clusterrolebindings
  3. register: "clusterrolebinding_state"
  4. command: "{{ bin_dir }}/kubectl get clusterrolebinding heketi-gluster-admin -o=name --ignore-not-found=true"
  5. changed_when: false
  6. - name: "Kubernetes Apps | Deploy cluster role binding."
  7. when: "clusterrolebinding_state.stdout == \"\""
  8. command: "{{ bin_dir }}/kubectl create clusterrolebinding heketi-gluster-admin --clusterrole=edit --serviceaccount=default:heketi-service-account"
  9. - name: Get clusterrolebindings again
  10. register: "clusterrolebinding_state"
  11. command: "{{ bin_dir }}/kubectl get clusterrolebinding heketi-gluster-admin -o=name --ignore-not-found=true"
  12. changed_when: false
  13. - name: Make sure that clusterrolebindings are present now
  14. assert:
  15. that: "clusterrolebinding_state.stdout != \"\""
  16. msg: "Cluster role binding is not present."
  17. - name: Get the heketi-config-secret secret
  18. register: "secret_state"
  19. command: "{{ bin_dir }}/kubectl get secret heketi-config-secret -o=name --ignore-not-found=true"
  20. changed_when: false
  21. - name: "Render Heketi secret configuration."
  22. become: true
  23. template:
  24. src: "heketi.json.j2"
  25. dest: "{{ kube_config_dir }}/heketi.json"
  26. - name: "Deploy Heketi config secret"
  27. when: "secret_state.stdout == \"\""
  28. command: "{{ bin_dir }}/kubectl create secret generic heketi-config-secret --from-file={{ kube_config_dir }}/heketi.json"
  29. - name: Get the heketi-config-secret secret again
  30. register: "secret_state"
  31. command: "{{ bin_dir }}/kubectl get secret heketi-config-secret -o=name --ignore-not-found=true"
  32. changed_when: false
  33. - name: Make sure the heketi-config-secret secret exists now
  34. assert:
  35. that: "secret_state.stdout != \"\""
  36. msg: "Heketi config secret is not present."