install_metrics.yaml 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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. - command: >
  62. {{openshift_client_binary}}
  63. --config={{mktemp.stdout}}/admin.kubeconfig
  64. get rc
  65. -l metrics-infra
  66. -o name
  67. -n {{openshift_metrics_project}}
  68. register: existing_metrics_rc
  69. changed_when: no
  70. - name: Scaling down cluster to recognize changes
  71. include_tasks: stop_metrics.yaml
  72. when: existing_metrics_rc.stdout_lines | length > 0
  73. - name: Scaling up cluster
  74. include_tasks: start_metrics.yaml
  75. tags: openshift_metrics_start_cluster
  76. when:
  77. - openshift_metrics_start_cluster | default(true) | bool