stop_metrics.yaml 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. ---
  2. - command: >
  3. {{openshift.common.client_binary}}
  4. --config={{mktemp.stdout}}/admin.kubeconfig
  5. get rc
  6. -l metrics-infra=heapster
  7. -o name
  8. -n {{openshift_metrics_project}}
  9. register: metrics_heapster_rc
  10. changed_when: "'No resources found' not in metrics_heapster_rc.stderr"
  11. check_mode: no
  12. - name: Stop Heapster
  13. oc_scale:
  14. kind: rc
  15. name: "{{object.split('/')[1]}}"
  16. kubeconfig: "{{mktemp.stdout}}/admin.kubeconfig"
  17. namespace: "{{openshift_metrics_project}}"
  18. replicas: 0
  19. with_items: "{{metrics_heapster_rc.stdout_lines}}"
  20. loop_control:
  21. loop_var: object
  22. - command: >
  23. {{openshift.common.client_binary}}
  24. --config={{mktemp.stdout}}/admin.kubeconfig
  25. get rc
  26. -l metrics-infra=hawkular-metrics
  27. -o name
  28. -n {{openshift_metrics_project}}
  29. register: metrics_hawkular_rc
  30. changed_when: "'No resources found' not in metrics_hawkular_rc.stderr"
  31. - name: Stop Hawkular Metrics
  32. oc_scale:
  33. kind: rc
  34. name: "{{object.split('/')[1]}}"
  35. kubeconfig: "{{mktemp.stdout}}/admin.kubeconfig"
  36. namespace: "{{openshift_metrics_project}}"
  37. replicas: 0
  38. with_items: "{{metrics_hawkular_rc.stdout_lines}}"
  39. loop_control:
  40. loop_var: object
  41. - command: >
  42. {{openshift.common.client_binary}} --config={{mktemp.stdout}}/admin.kubeconfig
  43. get rc
  44. -o name
  45. -l metrics-infra=hawkular-cassandra
  46. -n {{openshift_metrics_project}}
  47. register: metrics_cassandra_rc
  48. changed_when: "'No resources found' not in metrics_cassandra_rc.stderr"
  49. - name: Stop Hawkular Cassandra
  50. oc_scale:
  51. kind: rc
  52. name: "{{object.split('/')[1]}}"
  53. kubeconfig: "{{mktemp.stdout}}/admin.kubeconfig"
  54. namespace: "{{openshift_metrics_project}}"
  55. replicas: 0
  56. with_items: "{{metrics_cassandra_rc.stdout_lines}}"
  57. loop_control:
  58. loop_var: object
  59. when: metrics_cassandra_rc is defined