stop_cluster.yaml 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. ---
  2. - name: Retrieve list of fluentd hosts
  3. oc_obj:
  4. state: list
  5. kind: node
  6. when: "'--all' in openshift_logging_fluentd_hosts"
  7. register: fluentd_hosts
  8. - name: Set fact openshift_logging_fluentd_hosts
  9. set_fact:
  10. openshift_logging_fluentd_hosts: "{{ fluentd_hosts.results.results[0]['items'] | map(attribute='metadata.name') | list }}"
  11. when: "'--all' in openshift_logging_fluentd_hosts"
  12. - name: stop fluentd
  13. oc_label:
  14. name: "{{ fluentd_host }}"
  15. kind: node
  16. state: absent
  17. labels: "{{ openshift_logging_fluentd_nodeselector | oo_dict_to_list_of_dict }}"
  18. with_items: "{{ openshift_logging_fluentd_hosts }}"
  19. loop_control:
  20. loop_var: fluentd_host
  21. - name: Retrieve mux
  22. oc_obj:
  23. state: list
  24. kind: dc
  25. selector: "component=mux"
  26. namespace: "{{openshift_logging_namespace}}"
  27. register: mux_dc
  28. when: openshift_logging_use_mux
  29. - name: stop mux
  30. oc_scale:
  31. kind: dc
  32. name: "{{ object }}"
  33. namespace: "{{openshift_logging_namespace}}"
  34. replicas: 0
  35. with_items: "{{ mux_dc.results.results[0]['items'] | map(attribute='metadata.name') | list if 'results' in mux_dc else [] }}"
  36. loop_control:
  37. loop_var: object
  38. when: openshift_logging_use_mux
  39. - name: Retrieve elasticsearch
  40. oc_obj:
  41. state: list
  42. kind: dc
  43. selector: "component=es"
  44. namespace: "{{openshift_logging_namespace}}"
  45. register: es_dc
  46. - name: stop elasticsearch
  47. oc_scale:
  48. kind: dc
  49. name: "{{ object }}"
  50. namespace: "{{openshift_logging_namespace}}"
  51. replicas: 0
  52. with_items: "{{ es_dc.results.results[0]['items'] | map(attribute='metadata.name') | list }}"
  53. loop_control:
  54. loop_var: object
  55. - name: Retrieve kibana
  56. oc_obj:
  57. state: list
  58. kind: dc
  59. selector: "component=kibana"
  60. namespace: "{{openshift_logging_namespace}}"
  61. register: kibana_dc
  62. - name: stop kibana
  63. oc_scale:
  64. kind: dc
  65. name: "{{ object }}"
  66. namespace: "{{openshift_logging_namespace}}"
  67. replicas: 0
  68. with_items: "{{ kibana_dc.results.results[0]['items'] | map(attribute='metadata.name') | list }}"
  69. loop_control:
  70. loop_var: object
  71. - name: Retrieve curator
  72. oc_obj:
  73. state: list
  74. kind: dc
  75. selector: "component=curator"
  76. namespace: "{{openshift_logging_namespace}}"
  77. register: curator_dc
  78. - name: stop curator
  79. oc_scale:
  80. kind: dc
  81. name: "{{ object }}"
  82. namespace: "{{openshift_logging_namespace}}"
  83. replicas: 0
  84. with_items: "{{ curator_dc.results.results[0]['items'] | map(attribute='metadata.name') | list }}"
  85. loop_control:
  86. loop_var: object
  87. - name: Retrieve elasticsearch-ops
  88. oc_obj:
  89. state: list
  90. kind: dc
  91. selector: "component=es-ops"
  92. namespace: "{{openshift_logging_namespace}}"
  93. register: es_dc
  94. - name: stop elasticsearch-ops
  95. oc_scale:
  96. kind: dc
  97. name: "{{ object }}"
  98. namespace: "{{openshift_logging_namespace}}"
  99. replicas: 0
  100. with_items: "{{ es_dc.results.results[0]['items'] | map(attribute='metadata.name') | list }}"
  101. loop_control:
  102. loop_var: object
  103. when: openshift_logging_use_ops | bool
  104. - name: Retrieve kibana-ops
  105. oc_obj:
  106. state: list
  107. kind: dc
  108. selector: "component=kibana-ops"
  109. namespace: "{{openshift_logging_namespace}}"
  110. register: kibana_dc
  111. - name: stop kibana-ops
  112. oc_scale:
  113. kind: dc
  114. name: "{{ object }}"
  115. namespace: "{{openshift_logging_namespace}}"
  116. replicas: 0
  117. with_items: "{{ kibana_dc.results.results[0]['items'] | map(attribute='metadata.name') | list }}"
  118. loop_control:
  119. loop_var: object
  120. when: openshift_logging_use_ops | bool
  121. - name: Retrieve curator
  122. oc_obj:
  123. state: list
  124. kind: dc
  125. selector: "component=curator-ops"
  126. namespace: "{{openshift_logging_namespace}}"
  127. register: curator_dc
  128. - name: stop curator-ops
  129. oc_scale:
  130. kind: dc
  131. name: "{{ object }}"
  132. namespace: "{{openshift_logging_namespace}}"
  133. replicas: 0
  134. with_items: "{{ curator_dc.results.results[0]['items'] | map(attribute='metadata.name') | list }}"
  135. loop_control:
  136. loop_var: object
  137. when: openshift_logging_use_ops | bool