summaryrefslogtreecommitdiffstats
path: root/roles/openshift_logging/tasks
diff options
context:
space:
mode:
authorEric Wolinetz <ewolinet@redhat.com>2017-02-02 16:29:57 -0600
committerGitHub <noreply@github.com>2017-02-02 16:29:57 -0600
commit44efb12df99f0cc5647b2a76064d049226cd57ea (patch)
tree7ccddcf20de5f0b46a64e98bfc9980c90b03d613 /roles/openshift_logging/tasks
parent3cb6ca6fcddbc0117b943f70576481a65b23358a (diff)
parent51c7796b32c9fc0df30ea463ba238422158e7bad (diff)
downloadopenshift-44efb12df99f0cc5647b2a76064d049226cd57ea.tar.gz
openshift-44efb12df99f0cc5647b2a76064d049226cd57ea.tar.bz2
openshift-44efb12df99f0cc5647b2a76064d049226cd57ea.tar.xz
openshift-44efb12df99f0cc5647b2a76064d049226cd57ea.zip
Merge pull request #3239 from ewolinetz/logging_fix_immutable_spec_changes
Adding bool filter to when openshift_logging_use_ops evals and updati…
Diffstat (limited to 'roles/openshift_logging/tasks')
-rw-r--r--roles/openshift_logging/tasks/generate_routes.yaml2
-rw-r--r--roles/openshift_logging/tasks/generate_services.yaml6
-rw-r--r--roles/openshift_logging/tasks/install_curator.yaml4
-rw-r--r--roles/openshift_logging/tasks/install_elasticsearch.yaml10
-rw-r--r--roles/openshift_logging/tasks/install_kibana.yaml4
-rw-r--r--roles/openshift_logging/tasks/oc_apply.yaml35
-rw-r--r--roles/openshift_logging/tasks/start_cluster.yaml6
-rw-r--r--roles/openshift_logging/tasks/stop_cluster.yaml6
8 files changed, 48 insertions, 25 deletions
diff --git a/roles/openshift_logging/tasks/generate_routes.yaml b/roles/openshift_logging/tasks/generate_routes.yaml
index 25877ebff..60694f67e 100644
--- a/roles/openshift_logging/tasks/generate_routes.yaml
+++ b/roles/openshift_logging/tasks/generate_routes.yaml
@@ -17,5 +17,5 @@
- {name: logging-kibana-ops, host: "{{openshift_logging_kibana_ops_hostname}}"}
loop_control:
loop_var: route_info
- when: (route_info.name == 'logging-kibana-ops' and openshift_logging_use_ops) or route_info.name == 'logging-kibana'
+ when: (route_info.name == 'logging-kibana-ops' and openshift_logging_use_ops | bool) or route_info.name == 'logging-kibana'
changed_when: no
diff --git a/roles/openshift_logging/tasks/generate_services.yaml b/roles/openshift_logging/tasks/generate_services.yaml
index 8eaac76c4..5091c1209 100644
--- a/roles/openshift_logging/tasks/generate_services.yaml
+++ b/roles/openshift_logging/tasks/generate_services.yaml
@@ -52,7 +52,7 @@
selector:
provider: openshift
component: es-ops
- when: openshift_logging_use_ops
+ when: openshift_logging_use_ops | bool
check_mode: no
changed_when: no
@@ -67,7 +67,7 @@
selector:
provider: openshift
component: es-ops
- when: openshift_logging_use_ops
+ when: openshift_logging_use_ops | bool
check_mode: no
changed_when: no
@@ -82,6 +82,6 @@
selector:
provider: openshift
component: kibana-ops
- when: openshift_logging_use_ops
+ when: openshift_logging_use_ops | bool
check_mode: no
changed_when: no
diff --git a/roles/openshift_logging/tasks/install_curator.yaml b/roles/openshift_logging/tasks/install_curator.yaml
index fcfce4e1e..5b474ff39 100644
--- a/roles/openshift_logging/tasks/install_curator.yaml
+++ b/roles/openshift_logging/tasks/install_curator.yaml
@@ -15,7 +15,7 @@
register: curator_ops_replica_count
when:
- not ansible_check_mode
- - openshift_logging_use_ops
+ - openshift_logging_use_ops | bool
ignore_errors: yes
changed_when: no
@@ -48,6 +48,6 @@
curator_memory_limit: "{{openshift_logging_curator_ops_memory_limit }}"
replicas: "{{curator_ops_replica_count.stdout | default (0)}}"
curator_node_selector: "{{openshift_logging_curator_ops_nodeselector | default({}) }}"
- when: openshift_logging_use_ops
+ when: openshift_logging_use_ops | bool
check_mode: no
changed_when: no
diff --git a/roles/openshift_logging/tasks/install_elasticsearch.yaml b/roles/openshift_logging/tasks/install_elasticsearch.yaml
index 64e983557..1d6e55e44 100644
--- a/roles/openshift_logging/tasks/install_elasticsearch.yaml
+++ b/roles/openshift_logging/tasks/install_elasticsearch.yaml
@@ -56,7 +56,7 @@
es_dcs: "{{openshift_logging_facts.elasticsearch_ops.deploymentconfigs}}"
cluster_size: "{{openshift_logging_es_ops_cluster_size}}"
when:
- - openshift_logging_use_ops
+ - openshift_logging_use_ops | bool
- "{{es_dcs | length - openshift_logging_es_ops_cluster_size | abs > 1}}"
check_mode: no
@@ -71,7 +71,7 @@
openshift_logging_es_pvc_dynamic: "{{openshift_logging_es_ops_pvc_dynamic}}"
openshift_logging_es_pv_selector: "{{openshift_logging_es_ops_pv_selector}}"
when:
- - openshift_logging_use_ops
+ - openshift_logging_use_ops | bool
check_mode: no
- name: Init pool of DeploymentConfig names for Elasticsearch Ops
@@ -80,7 +80,7 @@
loop_control:
loop_var: deploy_name
when:
- - openshift_logging_use_ops
+ - openshift_logging_use_ops | bool
- name: Create new DeploymentConfig names for Elasticsearch Ops
set_fact: es_ops_dc_pool={{es_ops_dc_pool | default([]) + [deploy_name]}}
@@ -92,7 +92,7 @@
cluster_size: "{{openshift_logging_es_ops_cluster_size}}"
with_sequence: count={{ openshift_logging_es_ops_cluster_size | int - openshift_logging_current_es_ops_size | int }}
when:
- - openshift_logging_use_ops
+ - openshift_logging_use_ops | bool
check_mode: no
- name: Generate Elasticsearch DeploymentConfig for Ops
@@ -116,6 +116,6 @@
with_indexed_items:
- "{{ es_ops_dc_pool | default([]) }}"
when:
- - openshift_logging_use_ops
+ - openshift_logging_use_ops | bool
check_mode: no
changed_when: no
diff --git a/roles/openshift_logging/tasks/install_kibana.yaml b/roles/openshift_logging/tasks/install_kibana.yaml
index f4df7de0c..3aeff2cac 100644
--- a/roles/openshift_logging/tasks/install_kibana.yaml
+++ b/roles/openshift_logging/tasks/install_kibana.yaml
@@ -15,7 +15,7 @@
register: kibana_ops_replica_count
when:
- not ansible_check_mode
- - openshift_logging_use_ops
+ - openshift_logging_use_ops | bool
ignore_errors: yes
changed_when: no
@@ -55,6 +55,6 @@
kibana_proxy_memory_limit: "{{openshift_logging_kibana_ops_proxy_memory_limit }}"
replicas: "{{kibana_ops_replica_count.stdout | default (0)}}"
kibana_node_selector: "{{openshift_logging_kibana_ops_nodeselector | default({}) }}"
- when: openshift_logging_use_ops
+ when: openshift_logging_use_ops | bool
check_mode: no
changed_when: no
diff --git a/roles/openshift_logging/tasks/oc_apply.yaml b/roles/openshift_logging/tasks/oc_apply.yaml
index c362b7fca..cb9509de1 100644
--- a/roles/openshift_logging/tasks/oc_apply.yaml
+++ b/roles/openshift_logging/tasks/oc_apply.yaml
@@ -1,12 +1,13 @@
---
- name: Checking generation of {{file_content.kind}} {{file_content.metadata.name}}
- shell: >
+ command: >
{{ openshift.common.client_binary }}
--config={{ kubeconfig }}
get {{file_content.kind}} {{file_content.metadata.name}}
-o jsonpath='{.metadata.resourceVersion}'
- -n {{namespace}} || echo 0
+ -n {{namespace}}
register: generation_init
+ failed_when: "'not found' not in generation_init.stderr and generation_init.stdout == ''"
changed_when: no
- name: Applying {{file_name}}
@@ -19,11 +20,33 @@
changed_when: no
- name: Determine change status of {{file_content.kind}} {{file_content.metadata.name}}
- shell: >
+ command: >
{{ openshift.common.client_binary }} --config={{ kubeconfig }}
get {{file_content.kind}} {{file_content.metadata.name}}
-o jsonpath='{.metadata.resourceVersion}'
- -n {{namespace}} || echo 0
+ -n {{namespace}}
register: generation_changed
- failed_when: "'error' in generation_changed.stderr"
- changed_when: generation_changed.stdout | int > generation_init.stdout | int
+ failed_when: "'not found' not in generation_changed.stderr and generation_changed.stdout == ''"
+ changed_when: generation_changed.stdout | default (0) | int > generation_init.stdout | default(0) | int
+ when:
+ - "'field is immutable' not in generation_apply.stderr"
+
+- name: Removing previous {{file_name}}
+ command: >
+ {{ openshift.common.client_binary }} --config={{ kubeconfig }}
+ delete -f {{ file_name }}
+ -n {{ namespace }}
+ register: generation_delete
+ failed_when: "'error' in generation_delete.stderr"
+ changed_when: generation_delete.rc == 0
+ when: "'field is immutable' in generation_apply.stderr"
+
+- name: Recreating {{file_name}}
+ command: >
+ {{ openshift.common.client_binary }} --config={{ kubeconfig }}
+ apply -f {{ file_name }}
+ -n {{ namespace }}
+ register: generation_apply
+ failed_when: "'error' in generation_apply.stderr"
+ changed_when: generation_apply.rc == 0
+ when: "'field is immutable' in generation_apply.stderr"
diff --git a/roles/openshift_logging/tasks/start_cluster.yaml b/roles/openshift_logging/tasks/start_cluster.yaml
index 07489ae79..69d2b2b6b 100644
--- a/roles/openshift_logging/tasks/start_cluster.yaml
+++ b/roles/openshift_logging/tasks/start_cluster.yaml
@@ -86,7 +86,7 @@
with_items: "{{es_dc.stdout_lines}}"
loop_control:
loop_var: object
- when: openshift_logging_use_ops
+ when: openshift_logging_use_ops | bool
- command: >
{{openshift.common.client_binary}} --config={{mktemp.stdout}}/admin.kubeconfig get dc -l component=kibana-ops -o name -n {{openshift_logging_namespace}}
@@ -104,7 +104,7 @@
with_items: "{{kibana_dc.stdout_lines}}"
loop_control:
loop_var: object
- when: openshift_logging_use_ops
+ when: openshift_logging_use_ops | bool
- command: >
{{openshift.common.client_binary}} --config={{mktemp.stdout}}/admin.kubeconfig get dc -l component=curator-ops -o name -n {{openshift_logging_namespace}}
@@ -122,4 +122,4 @@
with_items: "{{curator_dc.stdout_lines}}"
loop_control:
loop_var: object
- when: openshift_logging_use_ops
+ when: openshift_logging_use_ops | bool
diff --git a/roles/openshift_logging/tasks/stop_cluster.yaml b/roles/openshift_logging/tasks/stop_cluster.yaml
index 8e0df8344..7826efabe 100644
--- a/roles/openshift_logging/tasks/stop_cluster.yaml
+++ b/roles/openshift_logging/tasks/stop_cluster.yaml
@@ -81,7 +81,7 @@
with_items: "{{es_dc.stdout_lines}}"
loop_control:
loop_var: object
- when: openshift_logging_use_ops
+ when: openshift_logging_use_ops | bool
- command: >
{{openshift.common.client_binary}} --config={{mktemp.stdout}}/admin.kubeconfig get dc -l component=kibana-ops -o name -n {{openshift_logging_namespace}}
@@ -98,7 +98,7 @@
with_items: "{{kibana_dc.stdout_lines}}"
loop_control:
loop_var: object
- when: openshift_logging_use_ops
+ when: openshift_logging_use_ops | bool
- command: >
{{openshift.common.client_binary}} --config={{mktemp.stdout}}/admin.kubeconfig get dc -l component=curator-ops -o name -n {{openshift_logging_namespace}}
@@ -115,4 +115,4 @@
with_items: "{{curator_dc.stdout_lines}}"
loop_control:
loop_var: object
- when: openshift_logging_use_ops
+ when: openshift_logging_use_ops | bool