install_hawkular.yaml 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. ---
  2. - name: Ensure that Hawkular 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_hawkular_nodeselector | map_to_pairs }}"
  8. openshift_master_ensure_nodes_service: Hawkular
  9. - command: >
  10. {{ openshift_client_binary }} -n {{ openshift_metrics_project | quote }}
  11. --config={{ mktemp.stdout }}/admin.kubeconfig
  12. get rc hawkular-metrics -o jsonpath='{.spec.replicas}'
  13. register: hawkular_metrics_replica_count
  14. failed_when: false
  15. changed_when: false
  16. - name: generate hawkular-metrics replication controller
  17. template:
  18. src: hawkular_metrics_rc.j2
  19. dest: "{{ mktemp.stdout }}/templates/hawkular_metrics_rc.yaml"
  20. vars:
  21. replica_count: "{{hawkular_metrics_replica_count.stdout | default(0)}}"
  22. node_selector: "{{openshift_metrics_hawkular_nodeselector | default('') }}"
  23. changed_when: false
  24. - name: read hawkular-metrics route destination ca certificate
  25. slurp: src={{ mktemp.stdout }}/ca.crt
  26. register: metrics_route_dest_ca_cert
  27. changed_when: false
  28. - block:
  29. - set_fact: hawkular_key={{ lookup('file', openshift_metrics_hawkular_key) }}
  30. when: openshift_metrics_hawkular_key is exists
  31. changed_when: false
  32. - set_fact: hawkular_cert={{ lookup('file', openshift_metrics_hawkular_cert) }}
  33. when: openshift_metrics_hawkular_cert is exists
  34. changed_when: false
  35. - set_fact: hawkular_ca={{ lookup('file', openshift_metrics_hawkular_ca) }}
  36. when: openshift_metrics_hawkular_ca is exists
  37. changed_when: false
  38. - name: generate the hawkular-metrics route
  39. template:
  40. src: route.j2
  41. dest: "{{ mktemp.stdout }}/templates/hawkular-metrics-route.yaml"
  42. vars:
  43. name: hawkular-metrics
  44. annotations: "{{ openshift_metrics_hawkular_route_annotations }}"
  45. labels:
  46. metrics-infra: hawkular-metrics
  47. host: "{{ openshift_metrics_hawkular_hostname }}"
  48. to:
  49. kind: Service
  50. name: hawkular-metrics
  51. tls:
  52. termination: reencrypt
  53. key: "{{ hawkular_key | default('') }}"
  54. certificate: "{{ hawkular_cert | default('') }}"
  55. ca_certificate: "{{ hawkular_ca | default('') }}"
  56. destination_ca_certificate: "{{ metrics_route_dest_ca_cert.content | b64decode }}"
  57. changed_when: false