From 562ee3a9a74a06d080847193b017cbe9e59d7077 Mon Sep 17 00:00:00 2001
From: James Slagle <jslagle@redhat.com>
Date: Tue, 25 Apr 2017 17:10:40 -0400
Subject: [PATCH] Add split-stack environments

Add 2 new environments to faciltate deploying split-stack:
environments/overcloud-baremetal.j2.yaml
environments/overcloud-services.j2.yaml

The environments are used to deploy 2 separate Heat stacks, one for just
the baremetal+network configuration and one for the service
configuration.

In order to keep Heat's view of the server's hostname consistent across
the 2 stacks the 2 environments set the same HostnameFormat with
"overcloud" as the stack name.

implements blueprint split-stack-default

Change-Id: I0b3f282c08af6fecea8f136908b806db70bada46
---
 environments/overcloud-baremetal.j2.yaml      | 19 +++++++++++++++++++
 environments/overcloud-services.yaml          |  7 +++++++
 network/ports/ctlplane_vip.yaml               |  2 +-
 overcloud-resource-registry-puppet.j2.yaml    |  2 ++
 overcloud.j2.yaml                             | 12 ++++++------
 ...t-stack-environments-1f817e24b5d90959.yaml |  7 +++++++
 6 files changed, 42 insertions(+), 7 deletions(-)
 create mode 100644 environments/overcloud-baremetal.j2.yaml
 create mode 100644 environments/overcloud-services.yaml
 create mode 100644 releasenotes/notes/split-stack-environments-1f817e24b5d90959.yaml

diff --git a/environments/overcloud-baremetal.j2.yaml b/environments/overcloud-baremetal.j2.yaml
new file mode 100644
index 0000000000..668e28de0a
--- /dev/null
+++ b/environments/overcloud-baremetal.j2.yaml
@@ -0,0 +1,19 @@
+resource_registry:
+  OS::TripleO::AllNodes::SoftwareConfig: OS::Heat::None
+  OS::TripleO::PostDeploySteps: OS::Heat::None
+  OS::TripleO::DefaultPasswords: OS::Heat::None
+  OS::TripleO::RandomString: OS::Heat::None
+  OS::TripleO::AllNodesDeployment: OS::Heat::None
+
+parameter_defaults:
+  # Deploy no services
+{% for role in roles %}
+  {{role.name}}Services: []
+{% endfor %}
+
+  # Consistent Hostname format
+  ControllerHostnameFormat: overcloud-controller-%index%
+  ComputeHostnameFormat: overcloud-novacompute-%index%
+  ObjectStorageHostnameFormat: overcloud-objectstorage-%index%
+  CephStorageHostnameFormat: overcloud-cephstorage-%index%
+  BlockStorageHostnameFormat: overcloud-blockstorage-%index%
diff --git a/environments/overcloud-services.yaml b/environments/overcloud-services.yaml
new file mode 100644
index 0000000000..c409b89979
--- /dev/null
+++ b/environments/overcloud-services.yaml
@@ -0,0 +1,7 @@
+parameter_defaults:
+  # Consistent Hostname format
+  ControllerDeployedServerHostnameFormat: overcloud-controller-%index%
+  ComputeDeployedServerHostnameFormat: overcloud-novacompute-%index%
+  ObjectStorageDeployedServerHostnameFormat: overcloud-objectstorage-%index%
+  CephStorageDeployedServerHostnameFormat: overcloud-cephstorage-%index%
+  BlockStorageDeployedServerHostnameFormat: overcloud-blockstorage-%index%
diff --git a/network/ports/ctlplane_vip.yaml b/network/ports/ctlplane_vip.yaml
index 386520cf4b..bb54ca6215 100644
--- a/network/ports/ctlplane_vip.yaml
+++ b/network/ports/ctlplane_vip.yaml
@@ -34,7 +34,7 @@ parameters:
 
 resources:
   VipPort:
-    type: OS::Neutron::Port
+    type: OS::TripleO::Network::Ports::ControlPlaneVipPort
     properties:
       network: {get_param: ControlPlaneNetwork}
       name: {get_param: PortName}
diff --git a/overcloud-resource-registry-puppet.j2.yaml b/overcloud-resource-registry-puppet.j2.yaml
index 0dc93f5c34..71afd08f28 100644
--- a/overcloud-resource-registry-puppet.j2.yaml
+++ b/overcloud-resource-registry-puppet.j2.yaml
@@ -4,10 +4,12 @@ resource_registry:
   OS::TripleO::PostDeploySteps: puppet/post.yaml
   OS::TripleO::PostUpgradeSteps: puppet/post-upgrade.yaml
   OS::TripleO::AllNodes::SoftwareConfig: puppet/all-nodes-config.yaml
+  OS::TripleO::AllNodesDeployment: OS::Heat::StructuredDeployments
   OS::TripleO::Hosts::SoftwareConfig: hosts-config.yaml
   OS::TripleO::Ssh::HostPubKey: extraconfig/tasks/ssh/host_public_key.yaml
   OS::TripleO::Ssh::KnownHostsConfig: extraconfig/tasks/ssh/known_hosts_config.yaml
   OS::TripleO::DefaultPasswords: default_passwords.yaml
+  OS::TripleO::RandomString: OS::Heat::RandomString
 
   # Tasks (for internal TripleO usage)
   OS::TripleO::Tasks::UpdateWorkflow: OS::Heat::None
diff --git a/overcloud.j2.yaml b/overcloud.j2.yaml
index 17bba6ba93..3244b252bf 100644
--- a/overcloud.j2.yaml
+++ b/overcloud.j2.yaml
@@ -242,15 +242,15 @@ resources:
                 HOST: {get_param: CloudNameStorageManagement}
 
   HeatAuthEncryptionKey:
-    type: OS::Heat::RandomString
+    type: OS::TripleO::RandomString
 
   PcsdPassword:
-    type: OS::Heat::RandomString
+    type: OS::TripleO::RandomString
     properties:
       length: 16
 
   HorizonSecret:
-    type: OS::Heat::RandomString
+    type: OS::TripleO::RandomString
     properties:
       length: 10
 
@@ -334,7 +334,7 @@ resources:
       servers: {get_attr: [{{role.name}}Servers, value]}
 
   {{role.name}}AllNodesDeployment:
-    type: OS::Heat::StructuredDeployments
+    type: OS::TripleO::AllNodesDeployment
     depends_on:
 {% for role_inner in roles %}
       - {{role_inner.name}}HostsDeployment
@@ -575,12 +575,12 @@ resources:
       UpdateIdentifier: {get_param: UpdateIdentifier}
 
   MysqlRootPassword:
-    type: OS::Heat::RandomString
+    type: OS::TripleO::RandomString
     properties:
       length: 10
 
   RabbitCookie:
-    type: OS::Heat::RandomString
+    type: OS::TripleO::RandomString
     properties:
       length: 20
       salt: {get_param: RabbitCookieSalt}
diff --git a/releasenotes/notes/split-stack-environments-1f817e24b5d90959.yaml b/releasenotes/notes/split-stack-environments-1f817e24b5d90959.yaml
new file mode 100644
index 0000000000..1bc99371a7
--- /dev/null
+++ b/releasenotes/notes/split-stack-environments-1f817e24b5d90959.yaml
@@ -0,0 +1,7 @@
+---
+features:
+  - Add 2 new example environments to facilitate deploying split-stack,
+    environments/overcloud-baremetal.j2.yaml and
+    environments/overcloud-services.yaml. The environments are used to deploy two
+    separate Heat stacks, one for just the baremetal+network configuration and one
+    for the service configuration.