summaryrefslogtreecommitdiffstats
path: root/roles/openshift_logging_elasticsearch/tasks/restart_cluster.yml
diff options
context:
space:
mode:
authorEric Wolinetz <ewolinet@redhat.com>2018-01-03 16:07:41 -0600
committerEric Wolinetz <ewolinet@redhat.com>2018-01-03 16:20:57 -0600
commit72c57c0d9c49ad87b2d0b4b0eb9bec3a4f8d1d0c (patch)
tree56ebe4947e601b1c234abca5eea1c2e21ba5e17f /roles/openshift_logging_elasticsearch/tasks/restart_cluster.yml
parent8119a5c87a1560c2f607c06f30383133cc7137e5 (diff)
downloadopenshift-72c57c0d9c49ad87b2d0b4b0eb9bec3a4f8d1d0c.tar.gz
openshift-72c57c0d9c49ad87b2d0b4b0eb9bec3a4f8d1d0c.tar.bz2
openshift-72c57c0d9c49ad87b2d0b4b0eb9bec3a4f8d1d0c.tar.xz
openshift-72c57c0d9c49ad87b2d0b4b0eb9bec3a4f8d1d0c.zip
Adding logic to do a full cluster restart if we are incrementing our major versions of ES
Diffstat (limited to 'roles/openshift_logging_elasticsearch/tasks/restart_cluster.yml')
-rw-r--r--roles/openshift_logging_elasticsearch/tasks/restart_cluster.yml23
1 files changed, 22 insertions, 1 deletions
diff --git a/roles/openshift_logging_elasticsearch/tasks/restart_cluster.yml b/roles/openshift_logging_elasticsearch/tasks/restart_cluster.yml
index 4a32453e3..be43357b1 100644
--- a/roles/openshift_logging_elasticsearch/tasks/restart_cluster.yml
+++ b/roles/openshift_logging_elasticsearch/tasks/restart_cluster.yml
@@ -11,17 +11,38 @@
changed_when: "'\"acknowledged\":true' in _disable_output.stdout"
when: _cluster_pods.stdout_lines | count > 0
+# Flush ES
+- name: "Flushing for logging-{{ _cluster_component }} cluster"
+ command: >
+ oc exec {{ _cluster_pods.stdout.split(' ')[0] }} -c elasticsearch -n {{ openshift_logging_elasticsearch_namespace }} -- {{ __es_local_curl }} -XPUT 'https://localhost:9200/_flush/synced'
+ register: _flush_output
+ changed_when: "'\"acknowledged\":true' in _flush_output.stdout"
+ when:
+ - _cluster_pods.stdout_lines | count > 0
+ - full_restart_cluster | bool
+
- command: >
oc get dc -l component={{ _cluster_component }},provider=openshift -n {{ openshift_logging_elasticsearch_namespace }} -o jsonpath={.items[*].metadata.name}
register: _cluster_dcs
+## restart all dcs for full restart
+- name: "Restart ES node {{ _es_node }}"
+ include_tasks: restart_es_node.yml
+ with_items: "{{ _cluster_dcs }}"
+ loop_control:
+ loop_var: _es_node
+ when:
+ - full_restart_cluster | bool
+
## restart the node if it's dc is in the list of nodes to restart?
- name: "Restart ES node {{ _es_node }}"
include_tasks: restart_es_node.yml
with_items: "{{ _restart_logging_nodes }}"
loop_control:
loop_var: _es_node
- when: _es_node in _cluster_dcs.stdout
+ when:
+ - not full_restart_cluster | bool
+ - _es_node in _cluster_dcs.stdout
## we may need a new first pod to run against -- fetch them all again
- command: >