install_metrics.yaml 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. ---
  2. - include_tasks: pre_install.yaml
  3. - name: Install Metrics
  4. include_tasks: "install_{{ include_file }}.yaml"
  5. with_items:
  6. - support
  7. - heapster
  8. - hawkular_schema_job
  9. - hawkular
  10. - cassandra
  11. loop_control:
  12. loop_var: include_file
  13. when: not openshift_metrics_heapster_standalone | bool
  14. - name: Install Heapster Standalone
  15. include_tasks: install_heapster.yaml
  16. when: openshift_metrics_heapster_standalone | bool
  17. - name: Install Hawkular OpenShift Agent (HOSA)
  18. include_tasks: install_hosa.yaml
  19. when: openshift_metrics_install_hawkular_agent | default(false) | bool
  20. - find:
  21. paths: "{{ mktemp.stdout }}/templates"
  22. patterns: "^(?!metrics-hawkular-openshift-agent).*.yaml"
  23. use_regex: true
  24. register: object_def_files
  25. changed_when: no
  26. - slurp:
  27. src: "{{item.path}}"
  28. register: object_defs
  29. with_items: "{{object_def_files.files}}"
  30. changed_when: no
  31. - name: Create objects
  32. include_tasks: oc_apply.yaml
  33. vars:
  34. kubeconfig: "{{ mktemp.stdout }}/admin.kubeconfig"
  35. namespace: "{{ openshift_metrics_project }}"
  36. file_name: "{{ item.source }}"
  37. file_content: "{{ item.content | b64decode | from_yaml }}"
  38. with_items: "{{ object_defs.results }}"
  39. - find:
  40. paths: "{{ mktemp.stdout }}/templates"
  41. patterns: "^metrics-hawkular-openshift-agent.*.yaml"
  42. use_regex: true
  43. register: hawkular_agent_object_def_files
  44. when: openshift_metrics_install_hawkular_agent | bool
  45. changed_when: no
  46. - slurp:
  47. src: "{{item.path}}"
  48. register: hawkular_agent_object_defs
  49. with_items: "{{ hawkular_agent_object_def_files.files }}"
  50. when: openshift_metrics_install_hawkular_agent | bool
  51. changed_when: no
  52. - name: Create Hawkular Agent objects
  53. include_tasks: oc_apply.yaml
  54. vars:
  55. kubeconfig: "{{ mktemp.stdout }}/admin.kubeconfig"
  56. namespace: "{{ openshift_metrics_hawkular_agent_namespace }}"
  57. file_name: "{{ item.source }}"
  58. file_content: "{{ item.content | b64decode | from_yaml }}"
  59. with_items: "{{ hawkular_agent_object_defs.results }}"
  60. when: openshift_metrics_install_hawkular_agent | bool
  61. # Update asset config in openshift-web-console namespace
  62. - name: Add metrics route information to web console asset config
  63. include_role:
  64. name: openshift_web_console
  65. tasks_from: update_console_config.yml
  66. vars:
  67. console_config_edits:
  68. - key: clusterInfo#metricsPublicURL
  69. value: "https://{{ openshift_metrics_hawkular_hostname}}/hawkular/metrics"
  70. when:
  71. - openshift_web_console_install | default(true) | bool
  72. - command: >
  73. {{openshift_client_binary}}
  74. --config={{mktemp.stdout}}/admin.kubeconfig
  75. get rc
  76. -l metrics-infra
  77. -o name
  78. -n {{openshift_metrics_project}}
  79. register: existing_metrics_rc
  80. changed_when: no
  81. - name: Scaling down cluster to recognize changes
  82. include_tasks: stop_metrics.yaml
  83. when: existing_metrics_rc.stdout_lines | length > 0
  84. - name: Scaling up cluster
  85. include_tasks: start_metrics.yaml
  86. tags: openshift_metrics_start_cluster
  87. when:
  88. - openshift_metrics_start_cluster | default(true) | bool