summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2018-01-23 11:56:48 -0800
committerGitHub <noreply@github.com>2018-01-23 11:56:48 -0800
commit13e1808da0d95ee6e72981fdce26505aa0eaa18a (patch)
treeb36823be1350d43ada4397c7b5b7351fb5372787
parent2631694740c53bb7df1dd44d966e99591193dd93 (diff)
parent74e13d4925eba6099b9052c4641b6d27ed406a0e (diff)
downloadopenshift-13e1808da0d95ee6e72981fdce26505aa0eaa18a.tar.gz
openshift-13e1808da0d95ee6e72981fdce26505aa0eaa18a.tar.bz2
openshift-13e1808da0d95ee6e72981fdce26505aa0eaa18a.tar.xz
openshift-13e1808da0d95ee6e72981fdce26505aa0eaa18a.zip
Merge pull request #6808 from spadgett/check-console-config-exists
Automatic merge from submit-queue. Bug 1534020 - Only set logging and metrics URLs if console config map exists Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1534020 Related to #6676, but for the tasks that update logging and metrics URLs. /king bug /assign @sdodson
-rw-r--r--roles/openshift_web_console/tasks/update_console_config.yml77
1 files changed, 41 insertions, 36 deletions
diff --git a/roles/openshift_web_console/tasks/update_console_config.yml b/roles/openshift_web_console/tasks/update_console_config.yml
index 4d2957977..41da2c16a 100644
--- a/roles/openshift_web_console/tasks/update_console_config.yml
+++ b/roles/openshift_web_console/tasks/update_console_config.yml
@@ -19,43 +19,48 @@
# value: "https://{{ openshift_logging_kibana_hostname }}"
# when: openshift_web_console_install | default(true) | bool
-- name: Read web console config map
+- name: Read the existing web console config map
oc_configmap:
namespace: openshift-web-console
name: webconsole-config
state: list
- register: webconsole_config
-
-- name: Make temp directory
- command: mktemp -d /tmp/console-ansible-XXXXXX
- register: mktemp_console
- changed_when: False
-
-- name: Copy web console config to temp file
- copy:
- content: "{{webconsole_config.results.results[0].data['webconsole-config.yaml']}}"
- dest: "{{ mktemp_console.stdout }}/webconsole-config.yaml"
-
-- name: Change web console config properties
- yedit:
- src: "{{ mktemp_console.stdout }}/webconsole-config.yaml"
- edits: "{{console_config_edits}}"
- separator: '#'
- state: present
-
-- name: Update web console config map
- oc_configmap:
- namespace: openshift-web-console
- name: webconsole-config
- state: present
- from_file:
- webconsole-config.yaml: "{{ mktemp_console.stdout }}/webconsole-config.yaml"
-
-- name: Remove temp directory
- file:
- state: absent
- name: "{{ mktemp_console.stdout }}"
- changed_when: False
-
-# TODO: Only rollout if config has changed.
-- include_tasks: rollout_console.yml
+ register: webconsole_config_map
+
+- set_fact:
+ existing_config_map_data: "{{ webconsole_config_map.results.results[0].data | default({}) }}"
+
+- when: existing_config_map_data['webconsole-config.yaml'] is defined
+ block:
+ - name: Make temp directory
+ command: mktemp -d /tmp/console-ansible-XXXXXX
+ register: mktemp_console
+ changed_when: False
+
+ - name: Copy the existing web console config to temp directory
+ copy:
+ content: "{{ existing_config_map_data['webconsole-config.yaml'] }}"
+ dest: "{{ mktemp_console.stdout }}/webconsole-config.yaml"
+
+ - name: Change web console config properties
+ yedit:
+ src: "{{ mktemp_console.stdout }}/webconsole-config.yaml"
+ edits: "{{console_config_edits}}"
+ separator: '#'
+ state: present
+
+ - name: Update web console config map
+ oc_configmap:
+ namespace: openshift-web-console
+ name: webconsole-config
+ state: present
+ from_file:
+ webconsole-config.yaml: "{{ mktemp_console.stdout }}/webconsole-config.yaml"
+
+ - name: Remove temp directory
+ file:
+ state: absent
+ name: "{{ mktemp_console.stdout }}"
+ changed_when: False
+
+ # TODO: Only rollout if config has changed.
+ - include_tasks: rollout_console.yml