summaryrefslogtreecommitdiffstats
path: root/roles/openshift_logging/tasks/patch_configmap_files.yaml
diff options
context:
space:
mode:
authorEric Wolinetz <ewolinet@redhat.com>2017-10-25 20:45:34 -0500
committerEric Wolinetz <ewolinet@redhat.com>2018-01-02 11:16:04 -0600
commit8cb27ae800df71ee816852df56cd2c861a0f0a0a (patch)
tree9a3f000d6bb886296912df6de0ececdfe7783a53 /roles/openshift_logging/tasks/patch_configmap_files.yaml
parent332764e4541d8c922f2589a533bb56b2a2419ac1 (diff)
downloadopenshift-8cb27ae800df71ee816852df56cd2c861a0f0a0a.tar.gz
openshift-8cb27ae800df71ee816852df56cd2c861a0f0a0a.tar.bz2
openshift-8cb27ae800df71ee816852df56cd2c861a0f0a0a.tar.xz
openshift-8cb27ae800df71ee816852df56cd2c861a0f0a0a.zip
Updating logging_facts to be able to pull values from config maps yaml files, use diffs to keep custom changes, white list certain settings when creating diffs
Diffstat (limited to 'roles/openshift_logging/tasks/patch_configmap_files.yaml')
-rw-r--r--roles/openshift_logging/tasks/patch_configmap_files.yaml31
1 files changed, 31 insertions, 0 deletions
diff --git a/roles/openshift_logging/tasks/patch_configmap_files.yaml b/roles/openshift_logging/tasks/patch_configmap_files.yaml
new file mode 100644
index 000000000..74a9cc287
--- /dev/null
+++ b/roles/openshift_logging/tasks/patch_configmap_files.yaml
@@ -0,0 +1,31 @@
+---
+## The purpose of this task file is to take in a list of configmap files provided
+## in the variable configmap_file_names, which correspond to the data sections
+## within a configmap. We iterate over each of these files and create a patch
+## from the diff between current_file and new_file to try to maintain any custom
+## changes that a user may have made to a currently deployed configmap while
+## trying to idempotently update with any role provided files.
+
+## The following variables are expected to be provided when including this task:
+# configmap_name -- This is the name of the configmap that the files exist in
+# configmap_namespace -- The namespace that the configmap lives in
+# configmap_file_names -- This is expected to be passed in as a dict
+# current_file -- The name of the data entry within the configmap
+# new_file -- The file path to the file we are comparing to current_file
+# protected_lines -- List of variables whose line will be excluded when creating a diff
+
+- oc_configmap:
+ name: "{{ configmap_name }}"
+ state: list
+ namespace: "{{ configmap_namespace }}"
+ register: __configmap_output
+
+- when: __configmap_output.results.stderr is undefined
+ include_tasks: patch_configmap_file.yaml
+ vars:
+ configmap_current_file: "{{ configmap_files.current_file }}"
+ configmap_new_file: "{{ configmap_files.new_file }}"
+ configmap_protected_lines: "{{ configmap_files.protected_lines | default([]) }}"
+ with_items: "{{ configmap_file_names }}"
+ loop_control:
+ loop_var: configmap_files