install_metrics.yaml 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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
  9. - cassandra
  10. loop_control:
  11. loop_var: include_file
  12. when: not openshift_metrics_heapster_standalone | bool
  13. - name: Install Heapster Standalone
  14. include_tasks: install_heapster.yaml
  15. when: openshift_metrics_heapster_standalone | bool
  16. - name: Install Hawkular OpenShift Agent (HOSA)
  17. include_tasks: install_hosa.yaml
  18. when: openshift_metrics_install_hawkular_agent | default(false) | bool
  19. - find:
  20. paths: "{{ mktemp.stdout }}/templates"
  21. patterns: "^(?!metrics-hawkular-openshift-agent).*.yaml"
  22. use_regex: true
  23. register: object_def_files
  24. changed_when: no
  25. - slurp:
  26. src: "{{item.path}}"
  27. register: object_defs
  28. with_items: "{{object_def_files.files}}"
  29. changed_when: no
  30. - name: Create objects
  31. include_tasks: oc_apply.yaml
  32. vars:
  33. kubeconfig: "{{ mktemp.stdout }}/admin.kubeconfig"
  34. namespace: "{{ openshift_metrics_project }}"
  35. file_name: "{{ item.source }}"
  36. file_content: "{{ item.content | b64decode | from_yaml }}"
  37. with_items: "{{ object_defs.results }}"
  38. - find:
  39. paths: "{{ mktemp.stdout }}/templates"
  40. patterns: "^metrics-hawkular-openshift-agent.*.yaml"
  41. use_regex: true
  42. register: hawkular_agent_object_def_files
  43. when: openshift_metrics_install_hawkular_agent | bool
  44. changed_when: no
  45. - slurp:
  46. src: "{{item.path}}"
  47. register: hawkular_agent_object_defs
  48. with_items: "{{ hawkular_agent_object_def_files.files }}"
  49. when: openshift_metrics_install_hawkular_agent | bool
  50. changed_when: no
  51. - name: Create Hawkular Agent objects
  52. include_tasks: oc_apply.yaml
  53. vars:
  54. kubeconfig: "{{ mktemp.stdout }}/admin.kubeconfig"
  55. namespace: "{{ openshift_metrics_hawkular_agent_namespace }}"
  56. file_name: "{{ item.source }}"
  57. file_content: "{{ item.content | b64decode | from_yaml }}"
  58. with_items: "{{ hawkular_agent_object_defs.results }}"
  59. when: openshift_metrics_install_hawkular_agent | bool
  60. - include_tasks: update_master_config.yaml
  61. when: not openshift.common.version_gte_3_9
  62. # Update asset config in openshift-web-console namespace
  63. - name: Add metrics route information to web console asset config
  64. include_role:
  65. name: openshift_web_console
  66. tasks_from: update_console_config.yml
  67. vars:
  68. console_config_edits:
  69. - key: clusterInfo#metricsPublicURL
  70. value: "https://{{ openshift_metrics_hawkular_hostname}}/hawkular/metrics"
  71. when: 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