install_cassandra.yaml 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. ---
  2. - shell: >
  3. {{ openshift.common.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. with_sequence: count={{ openshift_metrics_cassandra_replicas }}
  36. when:
  37. - openshift_metrics_cassandra_storage_type != 'emptydir'
  38. - openshift_metrics_cassandra_storage_type != 'dynamic'
  39. changed_when: false
  40. - name: generate hawkular-cassandra persistent volume claims (dynamic)
  41. template:
  42. src: pvc.j2
  43. dest: "{{ mktemp.stdout }}/templates/hawkular-cassandra-pvc{{ item }}.yaml"
  44. vars:
  45. obj_name: "{{ openshift_metrics_cassandra_pvc_prefix }}-{{ item }}"
  46. labels:
  47. metrics-infra: hawkular-cassandra
  48. annotations:
  49. volume.alpha.kubernetes.io/storage-class: dynamic
  50. access_modes: "{{ openshift_metrics_cassandra_pvc_access | list }}"
  51. size: "{{ openshift_metrics_cassandra_pvc_size }}"
  52. with_sequence: count={{ openshift_metrics_cassandra_replicas }}
  53. when: openshift_metrics_cassandra_storage_type == 'dynamic'
  54. changed_when: false