diff options
author | Eric Wolinetz <ewolinet@redhat.com> | 2017-10-25 20:45:34 -0500 |
---|---|---|
committer | Eric Wolinetz <ewolinet@redhat.com> | 2018-01-02 11:16:04 -0600 |
commit | 8cb27ae800df71ee816852df56cd2c861a0f0a0a (patch) | |
tree | 9a3f000d6bb886296912df6de0ececdfe7783a53 /roles/openshift_logging/tasks/set_defaults_from_current.yml | |
parent | 332764e4541d8c922f2589a533bb56b2a2419ac1 (diff) | |
download | openshift-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/set_defaults_from_current.yml')
-rw-r--r-- | roles/openshift_logging/tasks/set_defaults_from_current.yml | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/roles/openshift_logging/tasks/set_defaults_from_current.yml b/roles/openshift_logging/tasks/set_defaults_from_current.yml new file mode 100644 index 000000000..dde362abe --- /dev/null +++ b/roles/openshift_logging/tasks/set_defaults_from_current.yml @@ -0,0 +1,34 @@ +--- + +## We are pulling default values from configmaps if they exist already +## Using conditional_set_fact allows us to set the value of a variable based on +## the value of another one, if it is already defined. Else we don't set the +## left hand side (it stays undefined as well). + +## conditional_set_fact allows us to specify a fact source, so first we try to +## set variables in the logging-elasticsearch & logging-elasticsearch-ops configmaps +## afterwards we set the value of the variable based on the value in the inventory +## but fall back to using the value from a configmap as a default. If neither is set +## then the variable remains undefined and the role default will be used. + +- conditional_set_fact: + facts: "{{ openshift_logging_facts['elasticsearch']['configmaps']['logging-elasticsearch']['elasticsearch.yml'] | flatten_dict }}" + vars: + __openshift_logging_es_number_of_shards: index.number_of_shards + __openshift_logging_es_number_of_replicas: index.number_of_replicas + when: openshift_logging_facts['elasticsearch']['configmaps']['logging-elasticsearch'] is defined + +- conditional_set_fact: + facts: "{{ openshift_logging_facts['elasticsearch_ops']['configmaps']['logging-elasticsearch-ops']['elasticsearch.yml'] | flatten_dict }}" + vars: + __openshift_logging_es_ops_number_of_shards: index.number_of_shards + __openshift_logging_es_ops_number_of_replicas: index.number_of_replicas + when: openshift_logging_facts['elasticsearch_ops']['configmaps']['logging-elasticsearch-ops'] is defined + +- conditional_set_fact: + facts: "{{ hostvars[inventory_hostname] }}" + vars: + openshift_logging_es_number_of_shards: openshift_logging_es_number_of_shards | __openshift_logging_es_number_of_shards + openshift_logging_es_number_of_replicas: openshift_logging_es_number_of_replicas | __openshift_logging_es_number_of_replicas + openshift_logging_es_ops_number_of_shards: openshift_logging_es_ops_number_of_shards | __openshift_logging_es_ops_number_of_shards + openshift_logging_es_ops_number_of_replicas: openshift_logging_es_ops_number_of_replicas | __openshift_logging_es_ops_number_of_replicas |