From b35cd6f9a05c19abb8d721e2d79988861556663c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Andr=C3=A9?= Date: Mon, 24 Sep 2018 11:09:22 +0200 Subject: [PATCH] Introduce OpenShiftGlusterNodeVars heat param Removes conflict on OpenShiftGlobalVariables param that was overwritten by the openshift-cns.yaml environment file. The default options for CNS as now moved into the extraconfig/services/openshift-cns.yaml template and can be overwritten by setting the OpenShiftGlusterNodeVars heat parameter. Change-Id: I43052662e913a02945f22e9f541a45ce2d9d828c (cherry picked from commit bd5dddb58d13250c35d1c8091a773da7a8c349a0) --- environments/openshift-cns.yaml | 5 -- extraconfig/services/openshift-cns.yaml | 90 ++++++++++++---------- extraconfig/services/openshift-master.yaml | 3 + 3 files changed, 52 insertions(+), 46 deletions(-) diff --git a/environments/openshift-cns.yaml b/environments/openshift-cns.yaml index bcc4b02918..a3ce11a814 100644 --- a/environments/openshift-cns.yaml +++ b/environments/openshift-cns.yaml @@ -1,7 +1,2 @@ resource_registry: OS::TripleO::Services::OpenShift::GlusterFS: ../extraconfig/services/openshift-cns.yaml - -parameter_defaults: - OpenShiftGlobalVariables: - openshift_storage_glusterfs_namespace: glusterfs - openshift_storage_glusterfs_name: storage diff --git a/extraconfig/services/openshift-cns.yaml b/extraconfig/services/openshift-cns.yaml index 01c9424f4c..fe0dbfaa83 100644 --- a/extraconfig/services/openshift-cns.yaml +++ b/extraconfig/services/openshift-cns.yaml @@ -32,6 +32,10 @@ parameters: description: Mapping of service endpoint -> protocol. Typically set via parameter_defaults in the resource registry. type: json + OpenShiftGlusterNodeVars: + default: {} + description: OpenShift node vars specific for the gluster nodes + type: json OpenShiftGlusterDisks: default: - /dev/vdb @@ -106,45 +110,52 @@ outputs: set_fact: openshift_gluster_disks: {get_attr: [RoleParametersValue, value, OpenShiftGlusterDisks]} - - name: set openshift images vars fact + - name: set openshift gluster global vars fact set_fact: - openshift_gluster_images: - openshift_storage_glusterfs_image: - yaql: - expression: - $.data.image.rightSplit(":", 1)[0] - data: - image: {get_param: DockerOpenShiftGlusterFSImage} - openshift_storage_glusterfs_version: - yaql: - expression: - $.data.image.rightSplit(":", 1)[1] - data: - image: {get_param: DockerOpenShiftGlusterFSImage} - openshift_storage_glusterfs_block_image: - yaql: - expression: - $.data.image.rightSplit(":", 1)[0] - data: - image: {get_param: DockerOpenShiftGlusterFSBlockImage} - openshift_storage_glusterfs_block_version: - yaql: - expression: - $.data.image.rightSplit(":", 1)[1] - data: - image: {get_param: DockerOpenShiftGlusterFSBlockImage} - openshift_storage_glusterfs_heketi_image: - yaql: - expression: - $.data.image.rightSplit(":", 1)[0] - data: - image: {get_param: DockerOpenShiftGlusterFSHeketiImage} - openshift_storage_glusterfs_heketi_version: - yaql: - expression: - $.data.image.rightSplit(":", 1)[1] - data: - image: {get_param: DockerOpenShiftGlusterFSHeketiImage} + openshift_gluster_global_vars: + map_merge: + - {get_param: OpenShiftGlusterNodeVars} + - openshift_storage_glusterfs_image: + yaql: + expression: + $.data.image.rightSplit(":", 1)[0] + data: + image: {get_param: DockerOpenShiftGlusterFSImage} + openshift_storage_glusterfs_version: + yaql: + expression: + $.data.image.rightSplit(":", 1)[1] + data: + image: {get_param: DockerOpenShiftGlusterFSImage} + openshift_storage_glusterfs_block_image: + yaql: + expression: + $.data.image.rightSplit(":", 1)[0] + data: + image: {get_param: DockerOpenShiftGlusterFSBlockImage} + openshift_storage_glusterfs_block_version: + yaql: + expression: + $.data.image.rightSplit(":", 1)[1] + data: + image: {get_param: DockerOpenShiftGlusterFSBlockImage} + openshift_storage_glusterfs_heketi_image: + yaql: + expression: + $.data.image.rightSplit(":", 1)[0] + data: + image: {get_param: DockerOpenShiftGlusterFSHeketiImage} + openshift_storage_glusterfs_heketi_version: + yaql: + expression: + $.data.image.rightSplit(":", 1)[1] + data: + image: {get_param: DockerOpenShiftGlusterFSHeketiImage} + + - name: generate openshift gluster global vars + copy: + dest: "{{playbook_dir}}/openshift/global_gluster_vars.yml" + content: "{{openshift_gluster_global_vars|to_nice_yaml}}" - name: generate openshift inventory for openshift_glusterfs service lineinfile: @@ -187,6 +198,3 @@ outputs: ansible_become: true openshift_schedulable: true {% endfor %} - - vars: - {{openshift_gluster_images | to_nice_yaml() | indent(4) }} diff --git a/extraconfig/services/openshift-master.yaml b/extraconfig/services/openshift-master.yaml index 0519d15f53..fe16a19673 100644 --- a/extraconfig/services/openshift-master.yaml +++ b/extraconfig/services/openshift-master.yaml @@ -425,6 +425,9 @@ outputs: -i '{{playbook_dir}}/openshift/inventory' --extra-vars '@{{playbook_dir}}/openshift/global_defaults.yml' --extra-vars '@{{playbook_dir}}/openshift/global_vars.yml' + {% if groups['openshift_glusterfs'] | default([]) %} + --extra-vars '@{{playbook_dir}}/openshift/global_gluster_vars.yml' + {% endif %} '{{playbook_dir}}/openshift/playbook.yml' {%- endif -%} - name: print openshift command