Use shared-openstack.yaml to deploy openstack services

Change-Id: I37ce36c9e3445e80602719269b7ef46aded2fda3
Closes-Bug: PROD-22471
diff --git a/tcp_tests/templates/shared-openstack.yaml b/tcp_tests/templates/shared-openstack.yaml
index 37bf5f3..032000b 100644
--- a/tcp_tests/templates/shared-openstack.yaml
+++ b/tcp_tests/templates/shared-openstack.yaml
@@ -1,12 +1,16 @@
 {# Collection of common macroses shared across openstack services #}
 
-{%- macro MACRO_INSTALL_KEYSTONE() %}
-- description: Execute salt orchestration state to configure all needed
+{%- macro MACRO_INSTALL_KEYSTONE(USE_ORCHESTRATE=true) %}
+  {%- if USE_ORCHESTRATE %}
+- description: |
+    Execute salt orchestration state to configure all needed 
     prerequisites like creating SSH public key ant etc.
+    Workaround for PROD-22488, use for PROD-22535.
   cmd: salt-run state.orchestrate keystone.orchestrate.deploy
   node_name: {{ HOSTNAME_CFG01 }}
   retry: {count: 1, delay: 5}
   skip_fail: false
+  {%- endif %}
 
 - description: Install keystone service on primary node
   cmd: salt --hard-crash --state-output=mixed --state-verbose=False
@@ -36,6 +40,20 @@
   retry: {count: 1, delay: 15}
   skip_fail: false
 
+- description: Mount glusterfs.client volumes (resuires created 'keystone' system user)
+  cmd: salt --hard-crash --state-output=mixed --state-verbose=False
+    -C 'I@keystone:server' state.sls glusterfs.client -b 1
+  node_name: {{ HOSTNAME_CFG01 }}
+  retry: {count: 1, delay: 5}
+  skip_fail: false
+
+- description: Update fernet keys for keystone server on the mounted glusterfs volume
+  cmd: salt --hard-crash --state-output=mixed --state-verbose=False
+    -C 'I@keystone:server' state.sls keystone.server -b 1
+  node_name: {{ HOSTNAME_CFG01 }}
+  retry: {count: 1, delay: 5}
+  skip_fail: false
+
 - description: Populate keystone services/tenants/admins
   cmd: salt --hard-crash --state-output=mixed --state-verbose=False
     -C 'I@keystone:client' state.sls keystone.client
@@ -66,13 +84,20 @@
   retry: {count: 1, delay: 5}
   skip_fail: false
 
-- description: Update Fernet tokens
+- description: Mount glusterfs.client volumes (resuires created  'glusterfs' system user)
   cmd: salt --hard-crash --state-output=mixed --state-verbose=False
-    -C 'I@keystone:server' state.sls keystone.server
+    -C 'I@glance:server' state.sls glusterfs.client -b 1
   node_name: {{ HOSTNAME_CFG01 }}
   retry: {count: 1, delay: 5}
   skip_fail: false
 
+#- description: Setup glance.client
+#  cmd: salt --hard-crash --state-output=mixed --state-verbose=False
+#    -C 'I@glance:client' state.sls glance.client
+#  node_name: {{ HOSTNAME_CFG01 }}
+#  retry: {count: 1, delay: 5}
+#  skip_fail: false
+
 - description: Check glance image-list
   cmd: salt --hard-crash --state-output=mixed --state-verbose=False
     -C 'I@keystone:server' cmd.run '. /root/keystonerc; glance image-list'
@@ -112,7 +137,7 @@
   skip_fail: false
 {%- endmacro %}
 
-{%- macro MACRO_INSTALL_CINDER() %}
+{%- macro MACRO_INSTALL_CINDER(INSTALL_VOLUME=false) %}
 - description: Install cinder on primary node
   cmd: salt --hard-crash --state-output=mixed --state-verbose=False
     -C "I@cinder:controller and *01*" state.sls cinder
@@ -133,9 +158,19 @@
   node_name: {{ HOSTNAME_CFG01 }}
   retry: {count: 1, delay: 5}
   skip_fail: false
+
+  {%- if INSTALL_VOLUME %}
+- description: Install cinder volume
+  cmd: salt --hard-crash --state-output=mixed --state-verbose=False
+    -C 'I@cinder:volume' state.sls cinder
+  node_name: {{ HOSTNAME_CFG01 }}
+  retry: {count: 1, delay: 5}
+  skip_fail: false
+  {%- endif %}
+
 {%- endmacro %}
 
-{%- macro MACRO_INSTALL_NEUTRON() %}
+{%- macro MACRO_INSTALL_NEUTRON(INSTALL_GATEWAY=true) %}
 - description: Install neutron service on primary node
   cmd: salt --hard-crash --state-output=mixed --state-verbose=False
     -C "I@neutron:server and *01*" state.sls neutron.server
@@ -150,6 +185,7 @@
   retry: {count: 1, delay: 5}
   skip_fail: false
 
+  {%- if INSTALL_GATEWAY %}
 - description: Install neutron on gtw node
   cmd: salt --hard-crash --state-output=mixed --state-verbose=False
     -C 'I@neutron:gateway' state.sls neutron
@@ -163,6 +199,8 @@
   node_name: {{ HOSTNAME_CFG01 }}
   retry: {count: 1, delay: 5}
   skip_fail: false
+  {%- endif %}
+
 {%- endmacro %}
 
 {%- macro MACRO_INSTALL_HEAT() %}