stop_metrics.yaml 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. changed_when: metrics_hawkular_rc | length > 0
  42. - command: >
  43. {{openshift.common.client_binary}} --config={{mktemp.stdout}}/admin.kubeconfig
  44. get rc
  45. -o name
  46. -l metrics-infra=hawkular-cassandra
  47. -n {{openshift_metrics_project}}
  48. register: metrics_cassandra_rc
  49. changed_when: "'No resources found' not in metrics_cassandra_rc.stderr"
  50. - name: Stop Hawkular Cassandra
  51. oc_scale:
  52. kind: rc
  53. name: "{{object.split('/')[1]}}"
  54. kubeconfig: "{{mktemp.stdout}}/admin.kubeconfig"
  55. namespace: "{{openshift_metrics_project}}"
  56. replicas: 0
  57. with_items: "{{metrics_cassandra_rc.stdout_lines}}"
  58. loop_control:
  59. loop_var: object
  60. when: metrics_cassandra_rc is defined
  61. changed_when: metrics_cassandra_rc | length > 0