install_cassandra.yaml 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. ---
  2. - name: Ensure that Cassandra has nodes to run on
  3. import_role:
  4. name: openshift_control_plane
  5. tasks_from: ensure_nodes_matching_selector.yml
  6. vars:
  7. openshift_master_ensure_nodes_selector: "{{ openshift_metrics_cassandra_nodeselector | map_to_pairs }}"
  8. openshift_master_ensure_nodes_service: Cassandra
  9. - shell: >
  10. {{ openshift_client_binary }} -n {{ openshift_metrics_project | quote }}
  11. --config={{ mktemp.stdout }}/admin.kubeconfig
  12. get rc hawkular-cassandra-{{node}} -o jsonpath='{.spec.replicas}' || echo 0
  13. vars:
  14. node: "{{ item }}"
  15. register: cassandra_replica_count
  16. with_sequence: count={{ openshift_metrics_cassandra_replicas }}
  17. changed_when: false
  18. failed_when: false
  19. - name: generate hawkular-cassandra replication controllers
  20. template:
  21. src: hawkular_cassandra_rc.j2
  22. dest: "{{ mktemp.stdout }}/templates/hawkular-cassandra-rc{{ item }}.yaml"
  23. vars:
  24. node: "{{ item }}"
  25. master: "{{ (item == '1')|string|lower }}"
  26. replica_count: "{{cassandra_replica_count.results[item|int - 1].stdout}}"
  27. node_selector: "{{openshift_metrics_cassandra_nodeselector | default('') }}"
  28. with_sequence: count={{ openshift_metrics_cassandra_replicas }}
  29. changed_when: false
  30. - set_fact: openshift_metrics_cassandra_pvc_prefix="hawkular-metrics"
  31. when: "not openshift_metrics_cassandra_pvc_prefix or openshift_metrics_cassandra_pvc_prefix == ''"
  32. - include_tasks: generate_cassandra_pvcs.yaml
  33. with_sequence: count={{ openshift_metrics_cassandra_replicas }}
  34. loop_control:
  35. loop_var: metrics_pvc_index