diff options
author | Jeff Cantrill <jcantril@redhat.com> | 2017-01-27 11:25:19 -0500 |
---|---|---|
committer | Jeff Cantrill <jcantril@redhat.com> | 2017-01-27 11:28:44 -0500 |
commit | 3b0b14924534347f00d49802168becae3a7455a9 (patch) | |
tree | 04ff11effaf6d578459038f57c2cf989e01067f8 | |
parent | b31b6e3202e03394e8d8caf7813ee722d916d59e (diff) | |
download | openshift-3b0b14924534347f00d49802168becae3a7455a9.tar.gz openshift-3b0b14924534347f00d49802168becae3a7455a9.tar.bz2 openshift-3b0b14924534347f00d49802168becae3a7455a9.tar.xz openshift-3b0b14924534347f00d49802168becae3a7455a9.zip |
adopt oc_scale module for openshift_logging role
-rw-r--r-- | roles/openshift_logging/meta/main.yaml | 3 | ||||
-rw-r--r-- | roles/openshift_logging/tasks/scale.yaml | 28 | ||||
-rw-r--r-- | roles/openshift_logging/tasks/start_cluster.yaml | 54 | ||||
-rw-r--r-- | roles/openshift_logging/tasks/stop_cluster.yaml | 54 | ||||
-rw-r--r-- | roles/openshift_logging/tasks/upgrade_logging.yaml | 8 |
5 files changed, 79 insertions, 68 deletions
diff --git a/roles/openshift_logging/meta/main.yaml b/roles/openshift_logging/meta/main.yaml index 7050e51db..9c480f73a 100644 --- a/roles/openshift_logging/meta/main.yaml +++ b/roles/openshift_logging/meta/main.yaml @@ -1,7 +1,7 @@ --- galaxy_info: author: OpenShift Red Hat - description: OpenShift Embedded Router + description: OpenShift Aggregated Logging company: Red Hat, Inc. license: Apache License, Version 2.0 min_ansible_version: 2.2 @@ -12,4 +12,5 @@ galaxy_info: categories: - cloud dependencies: +- role: lib_openshift - role: openshift_facts diff --git a/roles/openshift_logging/tasks/scale.yaml b/roles/openshift_logging/tasks/scale.yaml deleted file mode 100644 index 125d3b8af..000000000 --- a/roles/openshift_logging/tasks/scale.yaml +++ /dev/null @@ -1,28 +0,0 @@ ---- -- command: > - {{ openshift.common.client_binary }} --config={{ mktemp.stdout }}/admin.kubeconfig get {{object}} - -o jsonpath='{.spec.replicas}' -n {{openshift_logging_namespace}} - register: replica_count - failed_when: replica_count.rc == 1 and 'exists' not in replica_count.stderr - when: not ansible_check_mode - changed_when: no - -- command: > - {{ openshift.common.client_binary }} --config={{ mktemp.stdout }}/admin.kubeconfig scale {{object}} - --replicas={{desired}} -n {{openshift_logging_namespace}} - register: scale_result - failed_when: scale_result.rc == 1 and 'exists' not in scale_result.stderr - when: - - not ansible_check_mode - - replica_count.stdout|int != desired - -- command: > - {{ openshift.common.client_binary }} --config={{ mktemp.stdout }}/admin.kubeconfig get {{object}} -n {{openshift_logging_namespace}} -o jsonpath='{.status.replicas}' - register: replica_counts - until: replica_counts.stdout|int == desired - retries: 30 - delay: 10 - when: - - not ansible_check_mode - - replica_count.stdout|int != desired - changed_when: no diff --git a/roles/openshift_logging/tasks/start_cluster.yaml b/roles/openshift_logging/tasks/start_cluster.yaml index 2d8af1385..07489ae79 100644 --- a/roles/openshift_logging/tasks/start_cluster.yaml +++ b/roles/openshift_logging/tasks/start_cluster.yaml @@ -26,9 +26,12 @@ changed_when: no - name: start elasticsearch - include: scale.yaml - vars: - desired: 1 + oc_scale: + kind: dc + name: "{{object.split('/')[1]}}" + namespace: "{{openshift_logging_namespace}}" + kubeconfig: "{{mktemp.stdout}}/admin.kubeconfig" + replicas: 1 with_items: "{{es_dc.stdout_lines}}" loop_control: loop_var: object @@ -40,9 +43,12 @@ changed_when: no - name: start kibana - include: scale.yaml - vars: - desired: "{{ openshift_logging_kibana_replica_count | default (1) }}" + oc_scale: + kind: dc + name: "{{object.split('/')[1]}}" + namespace: "{{openshift_logging_namespace}}" + kubeconfig: "{{mktemp.stdout}}/admin.kubeconfig" + replicas: "{{ openshift_logging_kibana_replica_count | default (1) }}" with_items: "{{kibana_dc.stdout_lines}}" loop_control: loop_var: object @@ -54,9 +60,12 @@ changed_when: no - name: start curator - include: scale.yaml - vars: - desired: 1 + oc_scale: + kind: dc + name: "{{object.split('/')[1]}}" + namespace: "{{openshift_logging_namespace}}" + kubeconfig: "{{mktemp.stdout}}/admin.kubeconfig" + replicas: 1 with_items: "{{curator_dc.stdout_lines}}" loop_control: loop_var: object @@ -68,9 +77,12 @@ changed_when: no - name: start elasticsearch-ops - include: scale.yaml - vars: - desired: 1 + oc_scale: + kind: dc + name: "{{object.split('/')[1]}}" + namespace: "{{openshift_logging_namespace}}" + kubeconfig: "{{mktemp.stdout}}/admin.kubeconfig" + replicas: 1 with_items: "{{es_dc.stdout_lines}}" loop_control: loop_var: object @@ -83,9 +95,12 @@ changed_when: no - name: start kibana-ops - include: scale.yaml - vars: - desired: "{{ openshift_logging_kibana_ops_replica_count | default (1) }}" + oc_scale: + kind: dc + name: "{{object.split('/')[1]}}" + namespace: "{{openshift_logging_namespace}}" + kubeconfig: "{{mktemp.stdout}}/admin.kubeconfig" + replicas: "{{ openshift_logging_kibana_ops_replica_count | default (1) }}" with_items: "{{kibana_dc.stdout_lines}}" loop_control: loop_var: object @@ -98,9 +113,12 @@ changed_when: no - name: start curator-ops - include: scale.yaml - vars: - desired: 1 + oc_scale: + kind: dc + name: "{{object.split('/')[1]}}" + namespace: "{{openshift_logging_namespace}}" + kubeconfig: "{{mktemp.stdout}}/admin.kubeconfig" + replicas: 1 with_items: "{{curator_dc.stdout_lines}}" loop_control: loop_var: object diff --git a/roles/openshift_logging/tasks/stop_cluster.yaml b/roles/openshift_logging/tasks/stop_cluster.yaml index c8e8fbd2c..8e0df8344 100644 --- a/roles/openshift_logging/tasks/stop_cluster.yaml +++ b/roles/openshift_logging/tasks/stop_cluster.yaml @@ -24,9 +24,12 @@ changed_when: no - name: stop elasticsearch - include: scale.yaml - vars: - desired: 0 + oc_scale: + kind: dc + name: "{{object.split('/')[1]}}" + namespace: "{{openshift_logging_namespace}}" + kubeconfig: "{{mktemp.stdout}}/admin.kubeconfig" + replicas: 0 with_items: "{{es_dc.stdout_lines}}" loop_control: loop_var: object @@ -37,9 +40,12 @@ changed_when: no - name: stop kibana - include: scale.yaml - vars: - desired: 0 + oc_scale: + kind: dc + name: "{{object.split('/')[1]}}" + namespace: "{{openshift_logging_namespace}}" + kubeconfig: "{{mktemp.stdout}}/admin.kubeconfig" + replicas: 0 with_items: "{{kibana_dc.stdout_lines}}" loop_control: loop_var: object @@ -50,9 +56,12 @@ changed_when: no - name: stop curator - include: scale.yaml - vars: - desired: 0 + oc_scale: + kind: dc + name: "{{object.split('/')[1]}}" + namespace: "{{openshift_logging_namespace}}" + kubeconfig: "{{mktemp.stdout}}/admin.kubeconfig" + replicas: 0 with_items: "{{curator_dc.stdout_lines}}" loop_control: loop_var: object @@ -63,9 +72,12 @@ changed_when: no - name: stop elasticsearch-ops - include: scale.yaml - vars: - desired: 0 + oc_scale: + kind: dc + name: "{{object.split('/')[1]}}" + namespace: "{{openshift_logging_namespace}}" + kubeconfig: "{{mktemp.stdout}}/admin.kubeconfig" + replicas: 0 with_items: "{{es_dc.stdout_lines}}" loop_control: loop_var: object @@ -77,9 +89,12 @@ changed_when: no - name: stop kibana-ops - include: scale.yaml - vars: - desired: 0 + oc_scale: + kind: dc + name: "{{object.split('/')[1]}}" + namespace: "{{openshift_logging_namespace}}" + kubeconfig: "{{mktemp.stdout}}/admin.kubeconfig" + replicas: 0 with_items: "{{kibana_dc.stdout_lines}}" loop_control: loop_var: object @@ -91,9 +106,12 @@ changed_when: no - name: stop curator-ops - include: scale.yaml - vars: - desired: 0 + oc_scale: + kind: dc + name: "{{object.split('/')[1]}}" + namespace: "{{openshift_logging_namespace}}" + kubeconfig: "{{mktemp.stdout}}/admin.kubeconfig" + replicas: 0 with_items: "{{curator_dc.stdout_lines}}" loop_control: loop_var: object diff --git a/roles/openshift_logging/tasks/upgrade_logging.yaml b/roles/openshift_logging/tasks/upgrade_logging.yaml index a93463239..cceacd538 100644 --- a/roles/openshift_logging/tasks/upgrade_logging.yaml +++ b/roles/openshift_logging/tasks/upgrade_logging.yaml @@ -14,9 +14,11 @@ check_mode: no - name: start elasticsearch - include: scale.yaml - vars: - desired: 1 + oc_scale: + kind: dc + name: "{{object.split('/')[1]}}" + namespace: "{{mktemp.stdout}}/admin.kubeconfig" + replicas: 1 with_items: "{{es_dc.stdout_lines}}" loop_control: loop_var: object |