Convert AllNodesExtraConfig to support composable roles
[apex-tripleo-heat-templates.git] / puppet / extraconfig / all_nodes / neutron-ml2-cisco-nexus-ucsm.yaml
index 277b074..728c7cc 100644 (file)
@@ -4,15 +4,7 @@ description: Configure hieradata for Network Cisco configuration
 
 parameters:
   # Parameters passed from the parent template
-  controller_servers:
-    type: json
-  compute_servers:
-    type: json
-  blockstorage_servers:
-    type: json
-  objectstorage_servers:
-    type: json
-  cephstorage_servers:
+  servers:
     type: json
 
   # extra parameters passed via parameter_defaults
@@ -65,11 +57,18 @@ parameters:
     default: false
   NetworkNexusSwitchHeartbeatTime:
     type: number
-    description: Time interval to check the state of the Nexus device
+    description: >
+      Time interval to check the state of the Nexus device. The units of this
+      object are seconds.  Setting this object to a value of 0 disables the
+      replay feature.
     default: 0
   NetworkNexusSwitchReplayCount:
     type: number
-    description: Number of times to attempt config replay
+    description: >
+      This configuration item is OBSOLETE.  The Nexus driver replay behavior
+      is to continue to attempt to connect to the down Nexus device with a
+      period equal to the heartbeat time interval.  This was previously the
+      Number of times to attempt config replay.
     default: 3
   NetworkNexusProviderVlanAutoCreate:
     type: boolean
@@ -131,8 +130,9 @@ resources:
   NetworkCiscoDeployment:
     type: OS::Heat::StructuredDeployments
     properties:
+      name: NetworkCiscoDeployment
       config: {get_resource: NetworkCiscoConfig}
-      servers:  {get_param: controller_servers}
+      servers:  {get_param: servers, Controller}
       input_values:
         UCSM_ip: {get_param: NetworkUCSMIp}
         UCSM_username: {get_param: NetworkUCSMUsername}
@@ -163,41 +163,55 @@ resources:
       config: |
         #!/bin/sh
         MACS=$(ifconfig  | grep ether | awk '{print $2}' | tr "\n" " ")
-        HOSTNAME=$(hostname -f)
-        echo "$HOSTNAME $MACS"
+        HOST_FQDN=$(hostname -f)
+        if [ -z "$HOST_FQDN" ]; then
+          HOSTNAME=$(hostname -s)
+          # hardcoding the domain name to avoid DNS lookup dependency
+          # same type of hardcoding appears elsewhere
+          # --ie. controller-puppet.yaml
+          # FIXME_HOSTNAME_DOMAIN_HARDCODE
+          echo "$HOSTNAME.localdomain $MACS"
+        else
+          echo "$HOST_FQDN $MACS"
+        fi
 
   CollectMacDeploymentsController:
     type: OS::Heat::SoftwareDeployments
     properties:
-      servers:  {get_param: controller_servers}
+      name: CollectMacDeploymentsController
+      servers:  {get_param: servers, Controller}
       config: {get_resource: CollectMacConfig}
       actions: ['CREATE'] # Only do this on CREATE
 
   CollectMacDeploymentsCompute:
     type: OS::Heat::SoftwareDeployments
     properties:
-      servers:  {get_param: compute_servers}
+      name: CollectMacDeploymentsCompute
+      servers:  {get_param: servers, Compute}
       config: {get_resource: CollectMacConfig}
       actions: ['CREATE'] # Only do this on CREATE
 
   CollectMacDeploymentsBlockStorage:
     type: OS::Heat::SoftwareDeployments
     properties:
-      servers:  {get_param: blockstorage_servers}
+      name: CollectMacDeploymentsBlockStorage
+      servers:  {get_param: servers, BlockStorage}
       config: {get_resource: CollectMacConfig}
       actions: ['CREATE'] # Only do this on CREATE
 
   CollectMacDeploymentsObjectStorage:
     type: OS::Heat::SoftwareDeployments
     properties:
-      servers:  {get_param: objectstorage_servers}
+      name: CollectMacDeploymentsObjectStorage
+      servers:  {get_param: servers, ObjectStorage}
       config: {get_resource: CollectMacConfig}
       actions: ['CREATE'] # Only do this on CREATE
 
   CollectMacDeploymentsCephStorage:
     type: OS::Heat::SoftwareDeployments
     properties:
-      servers:  {get_param: cephstorage_servers}
+      name: CollectMacDeploymentsCephStorage
+      servers:  {get_param: servers, CephStorage}
       config: {get_resource: CollectMacConfig}
       actions: ['CREATE'] # Only do this on CREATE
 
@@ -256,10 +270,14 @@ resources:
           for (mac,swport) in nexus[nexus_switch]['servers'].iteritems():
             lmac=mac.lower()
             if lmac in mac2host:
-              if mac2host[lmac] in nexus_cp[nexus_switch]['servers']:
-                nexus_cp[nexus_switch]['servers'][mac2host[lmac]]['ports'] += ',' + swport['ports']
+              hostname = mac2host[lmac]
+              # for puppet we need a unique title even at the 2nd key level
+              serv_key = nexus_switch + "::" + hostname
+              if serv_key in nexus_cp[nexus_switch]['servers']:
+                nexus_cp[nexus_switch]['servers'][serv_key]['ports'] += ',' + swport['ports']
               else:
-                nexus_cp[nexus_switch]['servers'][mac2host[lmac]] = swport
+                nexus_cp[nexus_switch]['servers'][serv_key] = swport
+                nexus_cp[nexus_switch]['servers'][serv_key]['hostname'] = hostname
             del nexus_cp[nexus_switch]['servers'][mac]
         # Note this echo means you can view the data via heat deployment-show
         print json.dumps(nexus_cp)
@@ -267,7 +285,8 @@ resources:
   MappingToNexusDeploymentsController:
     type: OS::Heat::SoftwareDeployment
     properties:
-      server:  {get_param: [controller_servers, '0']}
+      name: MappingToNexusDeploymentsController
+      server:  {get_param: [servers, Controller, '0']}
       config: {get_resource: MappingToNexusConfig}
       input_values:
         # FIXME(shardy): It'd be more convenient if we could join these
@@ -310,16 +329,9 @@ resources:
     type: OS::Heat::SoftwareDeployment
     depends_on: MappingToNexusDeploymentsController
     properties:
-      server:  {get_param: [controller_servers, '0']}
+      name: MappingToUCSMDeploymentsController
+      server:  {get_param: [servers, Controller, '0']}
       config: {get_resource: MappingToUCSMConfig}
       input_values:
         ucsm_config: {get_param: NetworkUCSMHostList}
       actions: ['CREATE'] # Only do this on CREATE
-
-outputs:
-  # The Deployment applying the hieradata outputs the derived config-id, which
-  # changes if the input_values change, so if the stdouts from
-  # NetworkCiscoDeployment change, we need to reapply puppet (which will
-  # happen if we return a different config_identifier)
-  config_identifier:
-    value: {get_attr: [NetworkCiscoDeployment, deploy_stdouts]}