Allow control of hostname formatting
authorSteven Hardy <shardy@redhat.com>
Mon, 15 Jun 2015 09:13:07 +0000 (05:13 -0400)
committerSteve Baker <sbaker@redhat.com>
Tue, 16 Jun 2015 22:23:09 +0000 (10:23 +1200)
Currently, we use the heat default server names, which results in some
fairly unreadable hostnames due to the level of nesting in the templates.

e.g ov-sszdbj5rdne-0-bhseh65edxv6-Controller-zoqc6tlypbdp

Instead, we allow the user to specify a format string per role, defaulted
to a string which formats the name e.g <stackname>-controller-<index>

e.g overcloud-controller-0

Optionally additional hostname components (not replaced by heat) could be
added, such that deployment time customization of hostnames via firstboot
scripts (e.g cloud-init) may be possible.

Should anyone wish to maintain the old heat-generated names, they can pass
an empty string via these parameters, which heat will treat as if no "name"
property was provided to OS::Nova::Server.

Change-Id: I1730caa0c2256f970da22ab21fa3aa1549b3f90b

ceph-storage.yaml
cinder-storage.yaml
compute.yaml
controller.yaml
overcloud-without-mergepy.yaml
puppet/ceph-storage-puppet.yaml
puppet/cinder-storage-puppet.yaml
puppet/compute-puppet.yaml
puppet/controller-puppet.yaml
puppet/swift-storage-puppet.yaml
swift-storage.yaml

index 138e6ea..2b44642 100644 (file)
@@ -39,6 +39,9 @@ parameters:
     description: >
       Setting to a previously unused value during stack-update will trigger
       package update on all nodes
+  Hostname:
+    type: string
+    default: '' # Defaults to Heat created hostname
 
 resources:
   CephStorage:
@@ -52,6 +55,7 @@ resources:
         - network: ctlplane
       user_data_format: SOFTWARE_CONFIG
       user_data: {get_resource: NodeUserData}
+      name: {get_param: Hostname}
 
   NodeUserData:
     type: OS::TripleO::NodeUserData
index 9541ed1..47a9708 100644 (file)
@@ -106,6 +106,9 @@ parameters:
     description: >
       Setting to a previously unused value during stack-update will trigger
       package update on all nodes
+  Hostname:
+    type: string
+    default: '' # Defaults to Heat created hostname
 
 resources:
   BlockStorage:
@@ -119,6 +122,7 @@ resources:
         - network: ctlplane
       user_data_format: SOFTWARE_CONFIG
       user_data: {get_resource: NodeUserData}
+      name: {get_param: Hostname}
 
   NodeUserData:
     type: OS::TripleO::NodeUserData
index abd5910..408e0f3 100644 (file)
@@ -254,6 +254,9 @@ parameters:
     description: >
       Setting to a previously unused value during stack-update will trigger
       package update on all nodes
+  Hostname:
+    type: string
+    default: '' # Defaults to Heat created hostname
 
 resources:
 
@@ -270,6 +273,7 @@ resources:
         - network: ctlplane
       user_data_format: SOFTWARE_CONFIG
       user_data: {get_resource: NodeUserData}
+      name: {get_param: Hostname}
 
   NodeUserData:
     type: OS::TripleO::NodeUserData
index 9fc9156..7baa576 100644 (file)
@@ -447,6 +447,9 @@ parameters:
     description: >
       Setting to a previously unused value during stack-update will trigger
       package update on all nodes
+  Hostname:
+    type: string
+    default: '' # Defaults to Heat created hostname
 
 resources:
 
@@ -461,6 +464,7 @@ resources:
         - network: ctlplane
       user_data_format: SOFTWARE_CONFIG
       user_data: {get_resource: NodeUserData}
+      name: {get_param: Hostname}
 
   NodeUserData:
     type: OS::TripleO::NodeUserData
index 97f0bd1..0244b65 100644 (file)
@@ -566,7 +566,32 @@ parameters:
     constraints:
       - custom_constraint: nova.flavor
 
-# Identifiers to trigger tasks on nodes
+  # Hostname format for each role
+  # Note %index% is translated into the index of the node, e.g 0/1/2 etc
+  # and %stackname% is replaced with OS::stack_name in the template below.
+  # If you want to use the heat generated names, pass '' (empty string).
+  ControllerHostnameFormat:
+    type: string
+    description: Format for Controller node hostnames
+    default: '%stackname%-controller-%index%'
+  ComputeHostnameFormat:
+    type: string
+    description: Format for Compute node hostnames
+    default: '%stackname%-novacompute-%index%'
+  BlockStorageHostnameFormat:
+    type: string
+    description: Format for BlockStorage node hostnames
+    default: '%stackname%-blockstorage-%index%'
+  ObjectStorageHostnameFormat:
+    type: string
+    description: Format for SwiftStorage node hostnames
+    default: '%stackname%-objectstorage-%index%'
+  CephStorageHostnameFormat:
+    type: string
+    description: Format for CephStorage node hostnames
+    default: '%stackname%-cephstorage-%index%'
+
+  # Identifiers to trigger tasks on nodes
   UpdateIdentifier:
     default: ''
     type: string
@@ -574,6 +599,8 @@ parameters:
       Setting to a previously unused value during stack-update will trigger
       package update on all nodes
 
+
+
 resources:
 
   HeatAuthEncryptionKey:
@@ -686,6 +713,11 @@ resources:
           KeystonePublicApiVirtualIP: {get_attr: [VipMap, net_ip_map, {get_param: [ServiceNetMap, KeystonePublicApiNetwork]}]}
           NeutronApiVirtualIP: {get_attr: [VipMap, net_ip_map, {get_param: [ServiceNetMap, NeutronApiNetwork]}]}
           UpdateIdentifier: {get_param: UpdateIdentifier}
+          Hostname:
+            str_replace:
+              template: {get_param: ControllerHostnameFormat}
+              params:
+                '%stackname%': {get_param: 'OS::stack_name'}
 
   Compute:
     type: OS::Heat::ResourceGroup
@@ -744,6 +776,11 @@ resources:
           SnmpdReadonlyUserPassword: {get_param: SnmpdReadonlyUserPassword}
           ServiceNetMap: {get_param: ServiceNetMap}
           UpdateIdentifier: {get_param: UpdateIdentifier}
+          Hostname:
+            str_replace:
+              template: {get_param: ComputeHostnameFormat}
+              params:
+                '%stackname%': {get_param: 'OS::stack_name'}
 
   BlockStorage:
     type: OS::Heat::ResourceGroup
@@ -769,6 +806,11 @@ resources:
           RabbitClientPort: {get_param: RabbitClientPort}
           NtpServer: {get_param: NtpServer}
           UpdateIdentifier: {get_param: UpdateIdentifier}
+          Hostname:
+            str_replace:
+              template: {get_param: BlockStorageHostnameFormat}
+              params:
+                '%stackname%': {get_param: 'OS::stack_name'}
 
   ObjectStorage:
     type: OS::Heat::ResourceGroup
@@ -789,6 +831,11 @@ resources:
           NtpServer: {get_param: NtpServer}
           UpdateIdentifier: {get_param: UpdateIdentifier}
           ServiceNetMap: {get_param: ServiceNetMap}
+          Hostname:
+            str_replace:
+              template: {get_param: ObjectStorageHostnameFormat}
+              params:
+                '%stackname%': {get_param: 'OS::stack_name'}
 
   CephStorage:
     type: OS::Heat::ResourceGroup
@@ -804,6 +851,11 @@ resources:
           NtpServer: {get_param: NtpServer}
           ServiceNetMap: {get_param: ServiceNetMap}
           UpdateIdentifier: {get_param: UpdateIdentifier}
+          Hostname:
+            str_replace:
+              template: {get_param: CephStorageHostnameFormat}
+              params:
+                '%stackname%': {get_param: 'OS::stack_name'}
 
   ControllerIpListMap:
     type: OS::TripleO::Network::Ports::NetIpListMap
index 1ab381a..cd32766 100644 (file)
@@ -39,6 +39,9 @@ parameters:
     description: >
       Setting to a previously unused value during stack-update will trigger
       package update on all nodes
+  Hostname:
+    type: string
+    default: '' # Defaults to Heat created hostname
 
 resources:
   CephStorage:
@@ -52,6 +55,7 @@ resources:
         - network: ctlplane
       user_data_format: SOFTWARE_CONFIG
       user_data: {get_resource: NodeUserData}
+      name: {get_param: Hostname}
 
   NodeUserData:
     type: OS::TripleO::NodeUserData
index 74df116..d4ed7b9 100644 (file)
@@ -117,6 +117,9 @@ parameters:
     description: >
       Setting to a previously unused value during stack-update will trigger
       package update on all nodes
+  Hostname:
+    type: string
+    default: '' # Defaults to Heat created hostname
 
 resources:
   BlockStorage:
@@ -130,6 +133,7 @@ resources:
         - network: ctlplane
       user_data_format: SOFTWARE_CONFIG
       user_data: {get_resource: NodeUserData}
+      name: {get_param: Hostname}
 
   NodeUserData:
     type: OS::TripleO::NodeUserData
index 9e17b89..4fa9b6b 100644 (file)
@@ -258,6 +258,9 @@ parameters:
     description: >
       Setting to a previously unused value during stack-update will trigger
       package update on all nodes
+  Hostname:
+    type: string
+    default: '' # Defaults to Heat created hostname
 
 resources:
 
@@ -274,6 +277,7 @@ resources:
         - network: ctlplane
       user_data_format: SOFTWARE_CONFIG
       user_data: {get_resource: NodeUserData}
+      name: {get_param: Hostname}
 
   NodeUserData:
     type: OS::TripleO::NodeUserData
index 05bd27a..8e0dc40 100644 (file)
@@ -460,6 +460,9 @@ parameters:
     description: >
       Setting to a previously unused value during stack-update will trigger
       package update on all nodes
+  Hostname:
+    type: string
+    default: '' # Defaults to Heat created hostname
 
 resources:
 
@@ -474,6 +477,7 @@ resources:
         - network: ctlplane
       user_data_format: SOFTWARE_CONFIG
       user_data: {get_resource: NodeUserData}
+      name: {get_param: Hostname}
 
   NodeUserData:
     type: OS::TripleO::NodeUserData
index e7ac613..11ddef8 100644 (file)
@@ -62,6 +62,9 @@ parameters:
     description: Mapping of service_name -> network name. Typically set
                  via parameter_defaults in the resource registry.
     type: json
+  Hostname:
+    type: string
+    default: '' # Defaults to Heat created hostname
 
 resources:
 
@@ -75,6 +78,7 @@ resources:
         - network: ctlplane
       user_data_format: SOFTWARE_CONFIG
       user_data: {get_resource: NodeUserData}
+      name: {get_param: Hostname}
 
   NodeUserData:
     type: OS::TripleO::NodeUserData
index c281934..466f2fb 100644 (file)
@@ -88,6 +88,9 @@ parameters:
     description: >
       Setting to a previously unused value during stack-update will trigger
       package update on all nodes
+  Hostname:
+    type: string
+    default: '' # Defaults to Heat created hostname
 
 resources:
   SwiftConfig:
@@ -118,6 +121,7 @@ resources:
         - network: ctlplane
       user_data_format: SOFTWARE_CONFIG
       user_data: {get_resource: NodeUserData}
+      name: {get_param: Hostname}
 
   NodeUserData:
     type: OS::TripleO::NodeUserData