diff options
Diffstat (limited to 'roles')
-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 | ||||
-rw-r--r-- | roles/openshift_metrics/meta/main.yaml | 1 | ||||
-rw-r--r-- | roles/openshift_metrics/tasks/scale.yaml | 30 | ||||
-rw-r--r-- | roles/openshift_metrics/tasks/start_metrics.yaml | 27 | ||||
-rw-r--r-- | roles/openshift_metrics/tasks/stop_metrics.yaml | 27 |
9 files changed, 116 insertions, 116 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 diff --git a/roles/openshift_metrics/meta/main.yaml b/roles/openshift_metrics/meta/main.yaml index 68e94992e..50214135c 100644 --- a/roles/openshift_metrics/meta/main.yaml +++ b/roles/openshift_metrics/meta/main.yaml @@ -15,4 +15,5 @@ galaxy_info: categories: - openshift dependencies: +- { role: lib_openshift } - { role: openshift_facts } diff --git a/roles/openshift_metrics/tasks/scale.yaml b/roles/openshift_metrics/tasks/scale.yaml deleted file mode 100644 index bb4fa621b..000000000 --- a/roles/openshift_metrics/tasks/scale.yaml +++ /dev/null @@ -1,30 +0,0 @@ ---- -- command: > - {{ openshift.common.client_binary }} --config={{ mktemp.stdout }}/admin.kubeconfig get {{object}} - -o jsonpath='{.spec.replicas}' -n {{openshift_metrics_project}} - 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_metrics_project}} - register: scale_result - failed_when: scale_result.rc == 1 and 'exists' not in scale_result.stderr - when: - - replica_count.stdout != (desired | string) - - not ansible_check_mode - changed_when: no - -- name: Waiting for {{object}} to scale to {{desired}} - command: > - {{ openshift.common.client_binary }} --config={{ mktemp.stdout }}/admin.kubeconfig - get {{object}} -n {{openshift_metrics_project|quote}} -o jsonpath='{.status.replicas}' - register: replica_counts - until: replica_counts.stdout.find("{{desired}}") != -1 - retries: 30 - delay: 10 - when: - - replica_count.stdout != (desired | string) - - not ansible_check_mode diff --git a/roles/openshift_metrics/tasks/start_metrics.yaml b/roles/openshift_metrics/tasks/start_metrics.yaml index c4cae4aff..f02774e47 100644 --- a/roles/openshift_metrics/tasks/start_metrics.yaml +++ b/roles/openshift_metrics/tasks/start_metrics.yaml @@ -10,9 +10,12 @@ changed_when: no - name: Start Hawkular Cassandra - include: scale.yaml - vars: - desired: 1 + oc_scale: + kind: rc + name: "{{object.split('/')[1]}}" + kubeconfig: "{{mktemp.stdout}}/admin.kubeconfig" + namespace: "{{openshift_metrics_project}}" + replicas: 1 with_items: "{{metrics_cassandra_rc.stdout_lines}}" loop_control: loop_var: object @@ -28,9 +31,12 @@ changed_when: no - name: Start Hawkular Metrics - include: scale.yaml - vars: - desired: "{{openshift_metrics_hawkular_replicas}}" + oc_scale: + kind: rc + name: "{{object.split('/')[1]}}" + kubeconfig: "{{mktemp.stdout}}/admin.kubeconfig" + namespace: "{{openshift_metrics_project}}" + replicas: "{{openshift_metrics_hawkular_replicas}}" with_items: "{{metrics_metrics_rc.stdout_lines}}" loop_control: loop_var: object @@ -46,9 +52,12 @@ changed_when: no - name: Start Heapster - include: scale.yaml - vars: - desired: 1 + oc_scale: + kind: rc + name: "{{object.split('/')[1]}}" + kubeconfig: "{{mktemp.stdout}}/admin.kubeconfig" + namespace: "{{openshift_metrics_project}}" + replicas: 1 with_items: "{{metrics_heapster_rc.stdout_lines}}" loop_control: loop_var: object diff --git a/roles/openshift_metrics/tasks/stop_metrics.yaml b/roles/openshift_metrics/tasks/stop_metrics.yaml index bae181e3e..5a73443a8 100644 --- a/roles/openshift_metrics/tasks/stop_metrics.yaml +++ b/roles/openshift_metrics/tasks/stop_metrics.yaml @@ -11,9 +11,12 @@ check_mode: no - name: Stop Heapster - include: scale.yaml - vars: - desired: 0 + oc_scale: + kind: rc + name: "{{object.split('/')[1]}}" + kubeconfig: "{{mktemp.stdout}}/admin.kubeconfig" + namespace: "{{openshift_metrics_project}}" + replicas: 0 with_items: "{{metrics_heapster_rc.stdout_lines}}" loop_control: loop_var: object @@ -29,9 +32,12 @@ changed_when: "'No resources found' not in metrics_hawkular_rc.stderr" - name: Stop Hawkular Metrics - include: scale.yaml - vars: - desired: 0 + oc_scale: + kind: rc + name: "{{object.split('/')[1]}}" + kubeconfig: "{{mktemp.stdout}}/admin.kubeconfig" + namespace: "{{openshift_metrics_project}}" + replicas: 0 with_items: "{{metrics_hawkular_rc.stdout_lines}}" loop_control: loop_var: object @@ -46,9 +52,12 @@ changed_when: "'No resources found' not in metrics_cassandra_rc.stderr" - name: Stop Hawkular Cassandra - include: scale.yaml - vars: - desired: 0 + oc_scale: + kind: rc + name: "{{object.split('/')[1]}}" + kubeconfig: "{{mktemp.stdout}}/admin.kubeconfig" + namespace: "{{openshift_metrics_project}}" + replicas: 0 with_items: "{{metrics_cassandra_rc.stdout_lines}}" loop_control: loop_var: object |