aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--environments/neutron-ml2-cisco-nexus-ucsm.yaml5
-rw-r--r--extraconfig/all_nodes/default.yaml27
-rw-r--r--extraconfig/all_nodes/mac_hostname.yaml116
-rw-r--r--extraconfig/all_nodes/random_string.yaml63
-rw-r--r--overcloud-resource-registry-puppet.yaml6
-rw-r--r--overcloud-resource-registry.yaml6
-rw-r--r--overcloud-without-mergepy.yaml32
-rw-r--r--puppet/extraconfig/all_nodes/neutron-ml2-cisco-nexus-ucsm.yaml325
-rw-r--r--puppet/extraconfig/pre_deploy/controller/network-cisco.yaml141
9 files changed, 571 insertions, 150 deletions
diff --git a/environments/neutron-ml2-cisco-nexus-ucsm.yaml b/environments/neutron-ml2-cisco-nexus-ucsm.yaml
index c291634c..5a1a32a3 100644
--- a/environments/neutron-ml2-cisco-nexus-ucsm.yaml
+++ b/environments/neutron-ml2-cisco-nexus-ucsm.yaml
@@ -1,13 +1,13 @@
# A Heat environment file which can be used to enable a
# a Cisco Neutron plugin.
resource_registry:
- OS::TripleO::ControllerExtraConfigPre: ../puppet/extraconfig/pre_deploy/controller/network-cisco.yaml
+ OS::TripleO::AllNodesExtraConfig: ../puppet/extraconfig/all_nodes/neutron-ml2-cisco-nexus-ucsm.yaml
parameter_defaults:
NetworkUCSMIp: '127.0.0.1'
NetworkUCSMUsername: 'admin'
NetworkUCSMPassword: 'password'
- NetworkUCSMHostList: 'host1:profile1, host2:profile2'
+ NetworkUCSMHostList: '12:34:56:78:9a:bc:profile1, 12:34:56:78:9a:de:profile2'
NetworkUCSMSupportedPciDevs: ''
NetworkNexusConfig: {}
NetworkNexusManagedPhysicalNetwork: ''
@@ -23,4 +23,3 @@ parameter_defaults:
NetworkNexusHostKeyChecks: 'false'
NetworkNexusVxlanVniRanges: '0:0'
NetworkNexusVxlanMcastRanges: '0.0.0.0:0.0.0.0'
-
diff --git a/extraconfig/all_nodes/default.yaml b/extraconfig/all_nodes/default.yaml
new file mode 100644
index 00000000..68f9eadd
--- /dev/null
+++ b/extraconfig/all_nodes/default.yaml
@@ -0,0 +1,27 @@
+heat_template_version: 2014-10-16
+
+description: >
+ Noop extra config for allnodes extra cluster config
+
+# Parameters passed from the parent template - note if you maintain
+# out-of-tree templates they may require additional parameters if the
+# in-tree templates add a new role.
+parameters:
+ controller_servers:
+ type: json
+ compute_servers:
+ type: json
+ blockstorage_servers:
+ type: json
+ objectstorage_servers:
+ type: json
+ cephstorage_servers:
+ type: json
+# Note extra parameters can be defined, then passed data via the
+# environment parameter_defaults, without modifying the parent template
+
+outputs:
+ # This value should change if the configuration data has changed
+ # It is used to e.g re-apply puppet after hieradata values change.
+ config_identifier:
+ value: none
diff --git a/extraconfig/all_nodes/mac_hostname.yaml b/extraconfig/all_nodes/mac_hostname.yaml
new file mode 100644
index 00000000..739cbf0a
--- /dev/null
+++ b/extraconfig/all_nodes/mac_hostname.yaml
@@ -0,0 +1,116 @@
+heat_template_version: 2014-10-16
+
+description: >
+ Example extra config for cluster config
+ this example collects the hostname and MAC addresses for each node in
+ the deployment, then distributes that info to all Controller nodes.
+
+# Parameters passed from the parent template - note if you maintain
+# out-of-tree templates they may require additional parameters if the
+# in-tree templates add a new role.
+parameters:
+ controller_servers:
+ type: json
+ compute_servers:
+ type: json
+ blockstorage_servers:
+ type: json
+ objectstorage_servers:
+ type: json
+ cephstorage_servers:
+ type: json
+# Note extra parameters can be defined, then passed data via the
+# environment parameter_defaults, without modifying the parent template
+
+resources:
+
+ CollectMacConfig:
+ type: OS::Heat::SoftwareConfig
+ properties:
+ group: script
+ config: |
+ #!/bin/sh
+ MACS=$(ifconfig | grep ether | awk '{print $2}' | tr "\n" " ")
+ HOSTNAME=$(hostname -s)
+ echo "$HOSTNAME $MACS"
+
+ # FIXME(shardy): Long term it'd be better if Heat SoftwareDeployments accepted
+ # list instead of a map, then we could join the lists of servers into one
+ # deployment instead of requiring one deployment per-role.
+ CollectMacDeploymentsController:
+ type: OS::Heat::SoftwareDeployments
+ properties:
+ servers: {get_param: controller_servers}
+ config: {get_resource: CollectMacConfig}
+ actions: ['CREATE'] # Only do this on CREATE
+
+ CollectMacDeploymentsCompute:
+ type: OS::Heat::SoftwareDeployments
+ properties:
+ servers: {get_param: compute_servers}
+ config: {get_resource: CollectMacConfig}
+ actions: ['CREATE'] # Only do this on CREATE
+
+ CollectMacDeploymentsBlockStorage:
+ type: OS::Heat::SoftwareDeployments
+ properties:
+ servers: {get_param: blockstorage_servers}
+ config: {get_resource: CollectMacConfig}
+ actions: ['CREATE'] # Only do this on CREATE
+
+ CollectMacDeploymentsObjectStorage:
+ type: OS::Heat::SoftwareDeployments
+ properties:
+ servers: {get_param: objectstorage_servers}
+ config: {get_resource: CollectMacConfig}
+ actions: ['CREATE'] # Only do this on CREATE
+
+ CollectMacDeploymentsCephStorage:
+ type: OS::Heat::SoftwareDeployments
+ properties:
+ servers: {get_param: cephstorage_servers}
+ config: {get_resource: CollectMacConfig}
+ actions: ['CREATE'] # Only do this on CREATE
+
+ # Now we distribute all-the-macs to all nodes
+ DistributeMacConfig:
+ type: OS::Heat::SoftwareConfig
+ properties:
+ group: script
+ inputs:
+ - name: controller_mappings
+ - name: compute_mappings
+ - name: blockstorage_mappings
+ - name: objectstorage_mappings
+ - name: cephstorage_mappings
+ config: |
+ #!/bin/sh
+ echo $controller_mappings > /root/controller_mappings
+ echo $compute_mappings > /root/compute_mappings
+ echo $blockstorage_mappings > /root/blockstorage_mappings
+ echo $objectstorage_mappings > /root/objectstorage_mappings
+ echo $cephstorage_mappings > /root/cephstorage_mappings
+ echo "mappings = $(cat /root/*_mappings)"
+
+ DistributeMacDeploymentsController:
+ type: OS::Heat::SoftwareDeployments
+ properties:
+ servers: {get_param: controller_servers}
+ config: {get_resource: DistributeMacConfig}
+ input_values:
+ # FIXME(shardy): It'd be more convenient if we could join these
+ # items together but because the returned format is a map (not a list)
+ # we can't use list_join or str_replace. Possible Heat TODO.
+ controller_mappings: {get_attr: [CollectMacDeploymentsController, deploy_stdouts]}
+ compute_mappings: {get_attr: [CollectMacDeploymentsCompute, deploy_stdouts]}
+ blockstorage_mappings: {get_attr: [CollectMacDeploymentsBlockStorage, deploy_stdouts]}
+ objectstorage_mappings: {get_attr: [CollectMacDeploymentsObjectStorage, deploy_stdouts]}
+ cephstorage_mappings: {get_attr: [CollectMacDeploymentsCephStorage, deploy_stdouts]}
+ actions: ['CREATE'] # Only do this on CREATE
+
+outputs:
+ # This value should change if the configuration data has changed
+ # It is used to e.g re-apply puppet after hieradata values change.
+ config_identifier:
+ value: {get_attr: [DistributeMacDeploymentsController, deploy_stdouts]}
+
diff --git a/extraconfig/all_nodes/random_string.yaml b/extraconfig/all_nodes/random_string.yaml
new file mode 100644
index 00000000..b4b30274
--- /dev/null
+++ b/extraconfig/all_nodes/random_string.yaml
@@ -0,0 +1,63 @@
+heat_template_version: 2014-10-16
+
+description: >
+ Example extra config for cluster config
+ this example deploys a random string to all controller and compute
+ nodes, showing how data may be shared amongst nodes, vs the
+ other ExtraConfig interfaces which act only on individual nodes.
+
+# Parameters passed from the parent template - note if you maintain
+# out-of-tree templates they may require additional parameters if the
+# in-tree templates add a new role.
+parameters:
+ controller_servers:
+ type: json
+ compute_servers:
+ type: json
+ blockstorage_servers:
+ type: json
+ objectstorage_servers:
+ type: json
+ cephstorage_servers:
+ type: json
+# Note extra parameters can be defined, then passed data via the
+# environment parameter_defaults, without modifying the parent template
+
+resources:
+
+ Random:
+ type: OS::Heat::RandomString
+
+ RandomConfig:
+ type: OS::Heat::SoftwareConfig
+ properties:
+ group: script
+ inputs:
+ - name: random_value
+ config: |
+ #!/bin/sh
+ echo $random_value > /root/random_value
+
+ RandomDeploymentsController:
+ type: OS::Heat::SoftwareDeployments
+ properties:
+ servers: {get_param: controller_servers}
+ config: {get_resource: RandomConfig}
+ actions: ['CREATE'] # Only do this on CREATE
+ input_values:
+ random_value: {get_attr: [Random, value]}
+
+ RandomDeploymentsCompute:
+ type: OS::Heat::SoftwareDeployments
+ properties:
+ servers: {get_param: compute_servers}
+ config: {get_resource: RandomConfig}
+ actions: ['CREATE'] # Only do this on CREATE
+ input_values:
+ random_value: {get_attr: [Random, value]}
+
+outputs:
+ # This value should change if the configuration data has changed
+ # It is used to e.g re-apply puppet after hieradata values change.
+ config_identifier:
+ value: {get_attr: [Random, value]}
diff --git a/overcloud-resource-registry-puppet.yaml b/overcloud-resource-registry-puppet.yaml
index 7680192f..cdf626ea 100644
--- a/overcloud-resource-registry-puppet.yaml
+++ b/overcloud-resource-registry-puppet.yaml
@@ -36,6 +36,12 @@ resource_registry:
OS::TripleO::ComputeExtraConfigPre: puppet/extraconfig/pre_deploy/default.yaml
OS::TripleO::NodeExtraConfigPost: extraconfig/post_deploy/default.yaml
+ # "AllNodes" Extra cluster config, runs on all nodes prior to the post_deploy
+ # phase, e.g when puppet is applied, but after the pre_deploy phase. Useful when
+ # configuration with knowledge of all nodes in the cluster is required vs single
+ # node configuration in the pre_deploy step.
+ OS::TripleO::AllNodesExtraConfig: extraconfig/all_nodes/default.yaml
+
# TripleO overcloud networks
OS::TripleO::Network: network/networks.yaml
OS::TripleO::VipConfig: puppet/vip-config.yaml
diff --git a/overcloud-resource-registry.yaml b/overcloud-resource-registry.yaml
index eaedf790..dd7e1a1c 100644
--- a/overcloud-resource-registry.yaml
+++ b/overcloud-resource-registry.yaml
@@ -23,6 +23,12 @@ resource_registry:
OS::TripleO::NodeExtraConfigPost: extraconfig/post_deploy/default.yaml
OS::TripleO::Tasks::PackageUpdate: extraconfig/tasks/yum_update.yaml
+ # "AllNodes" Extra cluster config, runs on all nodes prior to the post_deploy
+ # phase, e.g when puppet is applied, but after the pre_deploy phase. Useful when
+ # configuration with knowledge of all nodes in the cluster is required vs single
+ # node configuration in the pre_deploy step.
+ OS::TripleO::AllNodesExtraConfig: extraconfig/all_nodes/default.yaml
+
# TripleO overcloud networks
OS::TripleO::Network: network/networks.yaml
OS::TripleO::VipConfig: vip-config.yaml
diff --git a/overcloud-without-mergepy.yaml b/overcloud-without-mergepy.yaml
index 260952b3..e7c4dfc7 100644
--- a/overcloud-without-mergepy.yaml
+++ b/overcloud-without-mergepy.yaml
@@ -1301,42 +1301,62 @@ resources:
config: {get_resource: AllNodesValidationConfig}
servers: {get_attr: [CephStorage, attributes, nova_server_resource]}
+ # Optional ExtraConfig for all nodes - all roles are passed in here, but
+ # the nested template may configure each role differently (or not at all)
+ AllNodesExtraConfig:
+ type: OS::TripleO::AllNodesExtraConfig
+ properties:
+ controller_servers: {get_attr: [Controller, attributes, nova_server_resource]}
+ compute_servers: {get_attr: [Compute, attributes, nova_server_resource]}
+ blockstorage_servers: {get_attr: [BlockStorage, attributes, nova_server_resource]}
+ objectstorage_servers: {get_attr: [ObjectStorage, attributes, nova_server_resource]}
+ cephstorage_servers: {get_attr: [CephStorage, attributes, nova_server_resource]}
+
# Nested stack deployment runs after all other controller deployments
ControllerNodesPostDeployment:
type: OS::TripleO::ControllerPostDeployment
depends_on: [ControllerBootstrapNodeDeployment, ControllerAllNodesDeployment, ControllerSwiftDeployment, ControllerCephDeployment]
properties:
servers: {get_attr: [Controller, attributes, nova_server_resource]}
- NodeConfigIdentifiers: {get_attr: [Controller, attributes, config_identifier]}
+ NodeConfigIdentifiers:
+ allnodes_extra: {get_attr: [AllNodesExtraConfig, config_identifier]}
+ controller_config: {get_attr: [Controller, attributes, config_identifier]}
ComputeNodesPostDeployment:
type: OS::TripleO::ComputePostDeployment
depends_on: [ComputeAllNodesDeployment, ComputeCephDeployment]
properties:
servers: {get_attr: [Compute, attributes, nova_server_resource]}
- NodeConfigIdentifiers: {get_attr: [Compute, attributes, config_identifier]}
+ NodeConfigIdentifiers:
+ allnodes_extra: {get_attr: [AllNodesExtraConfig, config_identifier]}
+ compute_config: {get_attr: [Compute, attributes, config_identifier]}
ObjectStorageNodesPostDeployment:
type: OS::TripleO::ObjectStoragePostDeployment
depends_on: [ObjectStorageSwiftDeployment, ObjectStorageAllNodesDeployment]
properties:
servers: {get_attr: [ObjectStorage, attributes, nova_server_resource]}
- NodeConfigIdentifiers: {get_attr: [ObjectStorage, attributes, config_identifier]}
-
+ NodeConfigIdentifiers:
+ allnodes_extra: {get_attr: [AllNodesExtraConfig, config_identifier]}
+ objectstorage_config: {get_attr: [ObjectStorage, attributes, config_identifier]}
BlockStorageNodesPostDeployment:
type: OS::TripleO::BlockStoragePostDeployment
depends_on: [ControllerNodesPostDeployment, BlockStorageAllNodesDeployment]
properties:
servers: {get_attr: [BlockStorage, attributes, nova_server_resource]}
- NodeConfigIdentifiers: {get_attr: [BlockStorage, attributes, config_identifier]}
+ NodeConfigIdentifiers:
+ allnodes_extra: {get_attr: [AllNodesExtraConfig, config_identifier]}
+ blockstorage_config: {get_attr: [BlockStorage, attributes, config_identifier]}
CephStorageNodesPostDeployment:
type: OS::TripleO::CephStoragePostDeployment
depends_on: [ControllerNodesPostDeployment, CephStorageCephDeployment, CephStorageAllNodesDeployment]
properties:
servers: {get_attr: [CephStorage, attributes, nova_server_resource]}
- NodeConfigIdentifiers: {get_attr: [CephStorage, attributes, config_identifier]}
+ NodeConfigIdentifiers:
+ allnodes_extra: {get_attr: [AllNodesExtraConfig, config_identifier]}
+ cephstorage_config: {get_attr: [CephStorage, attributes, config_identifier]}
outputs:
KeystoneURL:
diff --git a/puppet/extraconfig/all_nodes/neutron-ml2-cisco-nexus-ucsm.yaml b/puppet/extraconfig/all_nodes/neutron-ml2-cisco-nexus-ucsm.yaml
new file mode 100644
index 00000000..277b0747
--- /dev/null
+++ b/puppet/extraconfig/all_nodes/neutron-ml2-cisco-nexus-ucsm.yaml
@@ -0,0 +1,325 @@
+heat_template_version: 2015-04-30
+
+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:
+ type: json
+
+ # extra parameters passed via parameter_defaults
+ NetworkUCSMIp:
+ type: string
+ description: Cisco UCSM IP
+ default: 127.0.0.1
+ NetworkUCSMUsername:
+ type: string
+ description: Cisco UCSM username
+ default: admin
+ NetworkUCSMPassword:
+ type: string
+ description: Cisco UCSM password
+ default: password
+ NetworkUCSMHostList:
+ type: string
+ description: >
+ Mac address to service profile mapping for UCSM-controlled hosts
+ The format is
+ '<host1-mac>:<profile>, <host2-mac>:<profile>, ...'
+ default: ''
+ NetworkUCSMSupportedPciDevs:
+ type: string
+ description: Cisco UCSM SR-IOV and VM-FEX vendors supported
+ default: ''
+ NetworkNexusConfig:
+ type: json
+ description: Nexus switch configuration
+ default: {}
+ NetworkNexusManagedPhysicalNetwork:
+ type: string
+ description: The name of the physical_network
+ default: ''
+ NetworkNexusVlanNamePrefix:
+ type: string
+ description: A short prefix to prepend to the VLAN name
+ default: 'q-'
+ NetworkNexusSviRoundRobin:
+ type: boolean
+ description: A flag to enable round robin scheduling
+ default: false
+ NetworkNexusProviderVlanNamePrefix:
+ type: string
+ description: A short prefix to prepend to the VLAN name
+ default: 'p-'
+ NetworkNexusPersistentSwitchConfig:
+ type: string
+ description: To make Nexus device persistent
+ default: false
+ NetworkNexusSwitchHeartbeatTime:
+ type: number
+ description: Time interval to check the state of the Nexus device
+ default: 0
+ NetworkNexusSwitchReplayCount:
+ type: number
+ description: Number of times to attempt config replay
+ default: 3
+ NetworkNexusProviderVlanAutoCreate:
+ type: boolean
+ description: A flag whether to manage the creation and removal of VLANs
+ default: true
+ NetworkNexusProviderVlanAutoTrunk:
+ type: boolean
+ description: A flag whether to manage the trunk ports on the Nexus
+ default: true
+ NetworkNexusVxlanGlobalConfig:
+ type: boolean
+ description: A flag whether to manage the VXLAN global settings
+ default: true
+ NetworkNexusHostKeyChecks:
+ type: boolean
+ description: enable strict host key checks when connecting to Nexus switches
+ default: false
+ NetworkNexusVxlanVniRanges:
+ type: string
+ description: VXLAN Network IDs that are available for tenant network
+ default: ''
+ NetworkNexusVxlanMcastRanges:
+ type: string
+ description: Multicast groups for the VXLAN interface.
+ default: ''
+
+
+resources:
+ # First we lay down the base configuration via the static hieradata mappings
+ NetworkCiscoConfig:
+ type: OS::Heat::StructuredConfig
+ properties:
+ group: os-apply-config
+ config:
+ hiera:
+ datafiles:
+ neutron_cisco_data:
+ mapped_data:
+ neutron::plugins::ml2::cisco::ucsm::ucsm_ip: {get_input: UCSM_ip}
+ neutron::plugins::ml2::cisco::ucsm::ucsm_username: {get_input: UCSM_username}
+ neutron::plugins::ml2::cisco::ucsm::ucsm_password: {get_input: UCSM_password}
+ neutron::plugins::ml2::cisco::ucsm::ucsm_host_list: {get_input: UCSM_host_list}
+ neutron::plugins::ml2::cisco::ucsm::supported_pci_devs: {get_input: UCSMSupportedPciDevs}
+ neutron::plugins::ml2::cisco::nexus::nexus_config: {get_input: NexusConfig}
+ neutron::plugins::ml2::cisco::nexus::managed_physical_network: {get_input: NexusManagedPhysicalNetwork}
+ neutron::plugins::ml2::cisco::nexus::vlan_name_prefix: {get_input: NexusVlanNamePrefix}
+ neutron::plugins::ml2::cisco::nexus::svi_round_robin: {get_input: NexusSviRoundRobin}
+ neutron::plugins::ml2::cisco::nexus::provider_vlan_name_prefix: {get_input: NexusProviderVlanNamePrefix}
+ neutron::plugins::ml2::cisco::nexus::persistent_switch_config: {get_input: NexusPersistentSwitchConfig}
+ neutron::plugins::ml2::cisco::nexus::switch_heartbeat_time: {get_input: NexusSwitchHeartbeatTime}
+ neutron::plugins::ml2::cisco::nexus::switch_replay_count: {get_input: NexusSwitchReplayCount}
+ neutron::plugins::ml2::cisco::nexus::provider_vlan_auto_create: {get_input: NexusProviderVlanAutoCreate}
+ neutron::plugins::ml2::cisco::nexus::provider_vlan_auto_trunk: {get_input: NexusProviderVlanAutoTrunk}
+ neutron::plugins::ml2::cisco::nexus::vxlan_global_config: {get_input: NexusVxlanGlobalConfig}
+ neutron::plugins::ml2::cisco::nexus::host_key_checks: {get_input: NexusHostKeyChecks}
+ neutron::plugins::ml2::cisco::type_nexus_vxlan::vni_ranges: {get_input: NexusVxlanVniRanges}
+ neutron::plugins::ml2::cisco::type_nexus_vxlan::mcast_ranges: {get_input: NexusVxlanMcastRanges}
+
+ NetworkCiscoDeployment:
+ type: OS::Heat::StructuredDeployments
+ properties:
+ config: {get_resource: NetworkCiscoConfig}
+ servers: {get_param: controller_servers}
+ input_values:
+ UCSM_ip: {get_param: NetworkUCSMIp}
+ UCSM_username: {get_param: NetworkUCSMUsername}
+ UCSM_password: {get_param: NetworkUCSMPassword}
+ UCSM_host_list: {get_attr: [MappingToUCSMDeploymentsController, deploy_stdout]}
+ UCSMSupportedPciDevs: {get_param: NetworkUCSMSupportedPciDevs}
+ NexusConfig: {get_attr: [MappingToNexusDeploymentsController, deploy_stdout]}
+ NexusManagedPhysicalNetwork: {get_param: NetworkNexusManagedPhysicalNetwork}
+ NexusVlanNamePrefix: {get_param: NetworkNexusVlanNamePrefix}
+ NexusSviRoundRobin: {get_param: NetworkNexusSviRoundRobin}
+ NexusProviderVlanNamePrefix: {get_param: NetworkNexusProviderVlanNamePrefix}
+ NexusPersistentSwitchConfig: {get_param: NetworkNexusPersistentSwitchConfig}
+ NexusSwitchHeartbeatTime: {get_param: NetworkNexusSwitchHeartbeatTime}
+ NexusSwitchReplayCount: {get_param: NetworkNexusSwitchReplayCount}
+ NexusProviderVlanAutoCreate: {get_param: NetworkNexusProviderVlanAutoCreate}
+ NexusProviderVlanAutoTrunk: {get_param: NetworkNexusProviderVlanAutoTrunk}
+ NexusVxlanGlobalConfig: {get_param: NetworkNexusVxlanGlobalConfig}
+ NexusHostKeyChecks: {get_param: NetworkNexusHostKeyChecks}
+ NexusVxlanVniRanges: {get_param: NetworkNexusVxlanVniRanges}
+ NexusVxlanMcastRanges: {get_param: NetworkNexusVxlanMcastRanges}
+
+ # Now we collect the Mac->Hostname mappings for all nodes, which enables
+ # calculation of the neutron::plugins::ml2::cisco::nexus::nexus_config data
+ CollectMacConfig:
+ type: OS::Heat::SoftwareConfig
+ properties:
+ group: script
+ config: |
+ #!/bin/sh
+ MACS=$(ifconfig | grep ether | awk '{print $2}' | tr "\n" " ")
+ HOSTNAME=$(hostname -f)
+ echo "$HOSTNAME $MACS"
+
+ CollectMacDeploymentsController:
+ type: OS::Heat::SoftwareDeployments
+ properties:
+ servers: {get_param: controller_servers}
+ config: {get_resource: CollectMacConfig}
+ actions: ['CREATE'] # Only do this on CREATE
+
+ CollectMacDeploymentsCompute:
+ type: OS::Heat::SoftwareDeployments
+ properties:
+ servers: {get_param: compute_servers}
+ config: {get_resource: CollectMacConfig}
+ actions: ['CREATE'] # Only do this on CREATE
+
+ CollectMacDeploymentsBlockStorage:
+ type: OS::Heat::SoftwareDeployments
+ properties:
+ servers: {get_param: blockstorage_servers}
+ config: {get_resource: CollectMacConfig}
+ actions: ['CREATE'] # Only do this on CREATE
+
+ CollectMacDeploymentsObjectStorage:
+ type: OS::Heat::SoftwareDeployments
+ properties:
+ servers: {get_param: objectstorage_servers}
+ config: {get_resource: CollectMacConfig}
+ actions: ['CREATE'] # Only do this on CREATE
+
+ CollectMacDeploymentsCephStorage:
+ type: OS::Heat::SoftwareDeployments
+ properties:
+ servers: {get_param: cephstorage_servers}
+ config: {get_resource: CollectMacConfig}
+ actions: ['CREATE'] # Only do this on CREATE
+
+ # Now we calculate the additional nexus config based on the mappings
+ MappingToNexusConfig:
+ type: OS::Heat::SoftwareConfig
+ properties:
+ group: script
+ inputs:
+ - name: controller_mappings
+ - name: compute_mappings
+ - name: blockstorage_mappings
+ - name: objectstorage_mappings
+ - name: cephstorage_mappings
+ - name: nexus_config
+ config: |
+ #!/bin/python
+ import ast
+ import json
+ import os
+ from copy import deepcopy
+
+ mappings = ['controller_mappings',
+ 'compute_mappings',
+ 'blockstorage_mappings',
+ 'objectstorage_mappings',
+ 'cephstorage_mappings',
+ 'nexus_config']
+ mapdict_list = []
+ nexus = {}
+ for map_name in mappings:
+ f_name = '/root/' + map_name
+ map_data = os.getenv(map_name, "Nada")
+ with open(f_name, 'a') as f:
+ f.write(map_data)
+ if map_data is not "Nada":
+ if map_name is not 'nexus_config':
+ mapdict_list.append(ast.literal_eval(map_data))
+ else:
+ nexus = ast.literal_eval(map_data)
+
+ mac2host = {}
+ for mapdict in mapdict_list:
+ for (listnum, host2mac_list) in mapdict.iteritems():
+ vals = host2mac_list.rstrip().split()
+ for mac in vals[1:]:
+ mac2host[mac.lower()] = vals[0]
+
+ with open('/root/mac2host', 'a') as f:
+ f.write(str(mac2host))
+
+ # now we have mac to host, map host to switchport in hieradata
+ # nexus = ast.literal_eval(os.getenv('nexus_config', None))
+ nexus_cp = deepcopy(nexus)
+ for nexus_switch in nexus:
+ 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']
+ else:
+ nexus_cp[nexus_switch]['servers'][mac2host[lmac]] = swport
+ 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)
+
+ MappingToNexusDeploymentsController:
+ type: OS::Heat::SoftwareDeployment
+ properties:
+ server: {get_param: [controller_servers, '0']}
+ config: {get_resource: MappingToNexusConfig}
+ input_values:
+ # FIXME(shardy): It'd be more convenient if we could join these
+ # items together but because the returned format is a map (not a list)
+ # we can't use list_join or str_replace. Possible Heat TODO.
+ controller_mappings: {get_attr: [CollectMacDeploymentsController, deploy_stdouts]}
+ compute_mappings: {get_attr: [CollectMacDeploymentsCompute, deploy_stdouts]}
+ blockstorage_mappings: {get_attr: [CollectMacDeploymentsBlockStorage, deploy_stdouts]}
+ objectstorage_mappings: {get_attr: [CollectMacDeploymentsObjectStorage, deploy_stdouts]}
+ cephstorage_mappings: {get_attr: [CollectMacDeploymentsCephStorage, deploy_stdouts]}
+ nexus_config: {get_param: NetworkNexusConfig}
+ actions: ['CREATE'] # Only do this on CREATE
+
+ MappingToUCSMConfig:
+ type: OS::Heat::SoftwareConfig
+ properties:
+ group: script
+ inputs:
+ - name: ucsm_config
+ config: |
+ #!/bin/python
+ import ast
+ import os
+ with open('/root/mac2host', 'r') as f:
+ s=f.read()
+ m2h=ast.literal_eval(s)
+ ucs_config = os.getenv('ucsm_config', "Nada")
+ ucs_data = []
+ lines = ucs_config.split(',')
+ for line in lines:
+ entry=line.rsplit(":",1)
+ mac = entry[0].lower().strip()
+ if mac in m2h:
+ ucs_data.append(m2h[mac] + ":" + entry[1])
+
+ print ", ".join(ucs_data)
+
+
+ MappingToUCSMDeploymentsController:
+ type: OS::Heat::SoftwareDeployment
+ depends_on: MappingToNexusDeploymentsController
+ properties:
+ server: {get_param: [controller_servers, '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]}
diff --git a/puppet/extraconfig/pre_deploy/controller/network-cisco.yaml b/puppet/extraconfig/pre_deploy/controller/network-cisco.yaml
deleted file mode 100644
index ed3bf291..00000000
--- a/puppet/extraconfig/pre_deploy/controller/network-cisco.yaml
+++ /dev/null
@@ -1,141 +0,0 @@
-heat_template_version: 2015-04-30
-
-description: Configure hieradata for Network Cisco configuration
-
-parameters:
- server:
- description: ID of the controller node to apply this config to
- type: string
-
- NetworkUCSMIp:
- type: string
- description: Cisco UCSM IP
- default: 127.0.0.1
- NetworkUCSMUsername:
- type: string
- description: Cisco UCSM username
- default: admin
- NetworkUCSMPassword:
- type: string
- description: Cisco UCSM password
- default: password
- NetworkUCSMHostList:
- type: string
- description: Cisco UCSM hostname
- default: 127.0.0.1
- NetworkUCSMSupportedPciDevs:
- type: string
- description: Cisco UCSM SR-IOV and VM-FEX vendors supported
- default: ''
- NetworkNexusConfig:
- type: json
- description: Nexus switch configuration
- default: {}
- NetworkNexusManagedPhysicalNetwork:
- type: string
- description: The name of the physical_network
- default: ''
- NetworkNexusVlanNamePrefix:
- type: string
- description: A short prefix to prepend to the VLAN name
- default: 'q-'
- NetworkNexusSviRoundRobin:
- type: boolean
- description: A flag to enable round robin scheduling
- default: false
- NetworkNexusProviderVlanNamePrefix:
- type: string
- description: A short prefix to prepend to the VLAN name
- default: 'p-'
- NetworkNexusPersistentSwitchConfig:
- type: string
- description: To make Nexus device persistent
- default: false
- NetworkNexusSwitchHeartbeatTime:
- type: number
- description: Time interval to check the state of the Nexus device
- default: 0
- NetworkNexusSwitchReplayCount:
- type: number
- description: Number of times to attempt config replay
- default: 3
- NetworkNexusProviderVlanAutoCreate:
- type: boolean
- description: A flag whether to manage the creation and removal of VLANs
- default: true
- NetworkNexusProviderVlanAutoTrunk:
- type: boolean
- description: A flag whether to manage the trunk ports on the Nexus
- default: true
- NetworkNexusVxlanGlobalConfig:
- type: boolean
- description: A flag whether to manage the VXLAN global settings
- default: true
- NetworkNexusHostKeyChecks:
- type: boolean
- description: enable strict host key checks when connecting to Nexus switches
- default: false
- NetworkNexusVxlanVniRanges:
- type: string
- description: VXLAN Network IDs that are available for tenant network
- default: ''
- NetworkNexusVxlanMcastRanges:
- type: string
- description: Multicast groups for the VXLAN interface.
- default: ''
-
-resources:
- NetworkCiscoConfig:
- type: OS::Heat::StructuredConfig
- properties:
- group: os-apply-config
- config:
- hiera:
- datafiles:
- neutron_cisco_data:
- mapped_data:
- neutron::plugins::ml2::cisco::ucsm::ucsm_ip: {get_input: UCSM_ip}
- neutron::plugins::ml2::cisco::ucsm::ucsm_username: {get_input: UCSM_username}
- neutron::plugins::ml2::cisco::ucsm::ucsm_password: {get_input: UCSM_password}
- neutron::plugins::ml2::cisco::ucsm::ucsm_host_list: {get_input: UCSM_host_list}
- neutron::plugins::ml2::cisco::ucsm::supported_pci_devs: {get_input: UCSMSupportedPciDevs}
- neutron::plugins::ml2::cisco::nexus::nexus_config: {get_input: NexusConfig}
- neutron::plugins::ml2::cisco::nexus::managed_physical_network: {get_input: NexusManagedPhysicalNetwork}
- neutron::plugins::ml2::cisco::nexus::vlan_name_prefix: {get_input: NexusVlanNamePrefix}
- neutron::plugins::ml2::cisco::nexus::svi_round_robin: {get_input: NexusSviRoundRobin}
- neutron::plugins::ml2::cisco::nexus::provider_vlan_name_prefix: {get_input: NexusProviderVlanNamePrefix}
- neutron::plugins::ml2::cisco::nexus::persistent_switch_config: {get_input: NexusPersistentSwitchConfig}
- neutron::plugins::ml2::cisco::nexus::switch_heartbeat_time: {get_input: NexusSwitchHeartbeatTime}
- neutron::plugins::ml2::cisco::nexus::switch_replay_count: {get_input: NexusSwitchReplayCount}
- neutron::plugins::ml2::cisco::nexus::provider_vlan_auto_create: {get_input: NexusProviderVlanAutoCreate}
- neutron::plugins::ml2::cisco::nexus::provider_vlan_auto_trunk: {get_input: NexusProviderVlanAutoTrunk}
- neutron::plugins::ml2::cisco::nexus::vxlan_global_config: {get_input: NexusVxlanGlobalConfig}
- neutron::plugins::ml2::cisco::nexus::host_key_checks: {get_input: NexusHostKeyChecks}
- neutron::plugins::ml2::cisco::type_nexus_vxlan::vni_ranges: {get_input: NexusVxlanVniRanges}
- neutron::plugins::ml2::cisco::type_nexus_vxlan::mcast_ranges: {get_input: NexusVxlanMcastRanges}
-
- NetworkCiscoDeployment:
- type: OS::Heat::StructuredDeployment
- properties:
- config: {get_resource: NetworkCiscoConfig}
- server: {get_param: server}
- input_values:
- UCSM_ip: {get_param: NetworkUCSMIp}
- UCSM_username: {get_param: NetworkUCSMUsername}
- UCSM_password: {get_param: NetworkUCSMPassword}
- UCSM_host_list: {get_param: NetworkUCSMHostList}
- UCSMSupportedPciDevs: {get_param: NetworkUCSMSupportedPciDevs}
- NexusConfig: {get_param: NetworkNexusConfig}
- NexusManagedPhysicalNetwork: {get_param: NetworkNexusManagedPhysicalNetwork}
- NexusVlanNamePrefix: {get_param: NetworkNexusVlanNamePrefix}
- NexusSviRoundRobin: {get_param: NetworkNexusSviRoundRobin}
- NexusProviderVlanNamePrefix: {get_param: NetworkNexusProviderVlanNamePrefix}
- NexusPersistentSwitchConfig: {get_param: NetworkNexusPersistentSwitchConfig}
- NexusSwitchHeartbeatTime: {get_param: NetworkNexusSwitchHeartbeatTime}
- NexusSwitchReplayCount: {get_param: NetworkNexusSwitchReplayCount}
- NexusProviderVlanAutoCreate: {get_param: NetworkNexusProviderVlanAutoCreate}
- NexusProviderVlanAutoTrunk: {get_param: NetworkNexusProviderVlanAutoTrunk}
- NexusVxlanGlobalConfig: {get_param: NetworkNexusVxlanGlobalConfig}
- NexusHostKeyChecks: {get_param: NetworkNexusHostKeyChecks}
- NexusVxlanVniRanges: {get_param: NetworkNexusVxlanVniRanges}
- NexusVxlanMcastRanges: {get_param: NetworkNexusVxlanMcastRanges}