install_cassandra.yaml 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. ---
  2. - shell: >
  3. {{ openshift_client_binary }} -n {{ openshift_metrics_project | quote }}
  4. --config={{ mktemp.stdout }}/admin.kubeconfig
  5. get rc hawkular-cassandra-{{node}} -o jsonpath='{.spec.replicas}' || echo 0
  6. vars:
  7. node: "{{ item }}"
  8. register: cassandra_replica_count
  9. with_sequence: count={{ openshift_metrics_cassandra_replicas }}
  10. changed_when: false
  11. failed_when: false
  12. - name: generate hawkular-cassandra replication controllers
  13. template:
  14. src: hawkular_cassandra_rc.j2
  15. dest: "{{ mktemp.stdout }}/templates/hawkular-cassandra-rc{{ item }}.yaml"
  16. vars:
  17. node: "{{ item }}"
  18. master: "{{ (item == '1')|string|lower }}"
  19. replica_count: "{{cassandra_replica_count.results[item|int - 1].stdout}}"
  20. node_selector: "{{openshift_metrics_cassandra_nodeselector | default('') }}"
  21. with_sequence: count={{ openshift_metrics_cassandra_replicas }}
  22. changed_when: false
  23. - set_fact: openshift_metrics_cassandra_pvc_prefix="hawkular-metrics"
  24. when: "not openshift_metrics_cassandra_pvc_prefix or openshift_metrics_cassandra_pvc_prefix == ''"
  25. - name: generate hawkular-cassandra persistent volume claims
  26. template:
  27. src: pvc.j2
  28. dest: "{{ mktemp.stdout }}/templates/hawkular-cassandra-pvc{{ item }}.yaml"
  29. vars:
  30. obj_name: "{{ openshift_metrics_cassandra_pvc_prefix }}-{{ item }}"
  31. labels:
  32. metrics-infra: hawkular-cassandra
  33. access_modes: "{{ openshift_metrics_cassandra_pvc_access | list }}"
  34. size: "{{ openshift_metrics_cassandra_pvc_size }}"
  35. pv_selector: "{{ openshift_metrics_cassandra_pv_selector }}"
  36. storage_class_name: "{{ openshift_metrics_cassanda_pvc_storage_class_name | default('', true) }}"
  37. with_sequence: count={{ openshift_metrics_cassandra_replicas }}
  38. when:
  39. - openshift_metrics_cassandra_storage_type != 'emptydir'
  40. - openshift_metrics_cassandra_storage_type != 'dynamic'
  41. changed_when: false
  42. - name: generate hawkular-cassandra persistent volume claims (dynamic)
  43. template:
  44. src: pvc.j2
  45. dest: "{{ mktemp.stdout }}/templates/hawkular-cassandra-pvc{{ item }}.yaml"
  46. vars:
  47. obj_name: "{{ openshift_metrics_cassandra_pvc_prefix }}-{{ item }}"
  48. labels:
  49. metrics-infra: hawkular-cassandra
  50. access_modes: "{{ openshift_metrics_cassandra_pvc_access | list }}"
  51. size: "{{ openshift_metrics_cassandra_pvc_size }}"
  52. pv_selector: "{{ openshift_metrics_cassandra_pv_selector }}"
  53. storage_class_name: "{{ openshift_metrics_cassanda_pvc_storage_class_name | default('', true) }}"
  54. with_sequence: count={{ openshift_metrics_cassandra_replicas }}
  55. when: openshift_metrics_cassandra_storage_type == 'dynamic'
  56. changed_when: false