1 heat_template_version: 2014-10-16
4 Example extra config for cluster config
5 this example collects the hostname and MAC addresses for each node in
6 the deployment, then distributes that info to all Controller nodes.
8 # Parameters passed from the parent template - note if you maintain
9 # out-of-tree templates they may require additional parameters if the
10 # in-tree templates add a new role.
14 # Note extra parameters can be defined, then passed data via the
15 # environment parameter_defaults, without modifying the parent template
20 type: OS::Heat::SoftwareConfig
25 MACS=$(ifconfig | grep ether | awk '{print $2}' | tr "\n" " ")
26 HOSTNAME=$(hostname -s)
27 echo "$HOSTNAME $MACS"
29 # FIXME(shardy): Long term it'd be better if Heat SoftwareDeployments accepted
30 # list instead of a map, then we could join the lists of servers into one
31 # deployment instead of requiring one deployment per-role.
32 {% for role in roles %}
33 CollectMacDeployments{{role.name}}:
34 type: OS::Heat::SoftwareDeployments
36 name: CollectMacDeploymentsController
37 servers: {get_param: [servers, {{role.name}}]}
38 config: {get_resource: CollectMacConfig}
39 actions: ['CREATE'] # Only do this on CREATE
42 # Now we distribute all-the-macs to all Controller nodes
44 type: OS::Heat::SoftwareConfig
48 - name: controller_mappings
49 - name: compute_mappings
50 - name: blockstorage_mappings
51 - name: objectstorage_mappings
52 - name: cephstorage_mappings
55 echo $controller_mappings > /root/controller_mappings
56 echo $compute_mappings > /root/compute_mappings
57 echo $blockstorage_mappings > /root/blockstorage_mappings
58 echo $objectstorage_mappings > /root/objectstorage_mappings
59 echo $cephstorage_mappings > /root/cephstorage_mappings
60 echo "mappings = $(cat /root/*_mappings)"
62 DistributeMacDeploymentsController:
63 type: OS::Heat::SoftwareDeployments
65 name: DistributeMacDeploymentsController
66 servers: {get_param: [servers, Controller]}
67 config: {get_resource: DistributeMacConfig}
69 # FIXME(shardy): It'd be more convenient if we could join these
70 # items together but because the returned format is a map (not a list)
71 # we can't use list_join or str_replace. Possible Heat TODO.
72 controller_mappings: {get_attr: [CollectMacDeploymentsController, deploy_stdouts]}
73 compute_mappings: {get_attr: [CollectMacDeploymentsCompute, deploy_stdouts]}
74 blockstorage_mappings: {get_attr: [CollectMacDeploymentsBlockStorage, deploy_stdouts]}
75 objectstorage_mappings: {get_attr: [CollectMacDeploymentsObjectStorage, deploy_stdouts]}
76 cephstorage_mappings: {get_attr: [CollectMacDeploymentsCephStorage, deploy_stdouts]}
77 actions: ['CREATE'] # Only do this on CREATE