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.
18 objectstorage_servers:
22 # Note extra parameters can be defined, then passed data via the
23 # environment parameter_defaults, without modifying the parent template
28 type: OS::Heat::SoftwareConfig
33 MACS=$(ifconfig | grep ether | awk '{print $2}' | tr "\n" " ")
34 HOSTNAME=$(hostname -s)
35 echo "$HOSTNAME $MACS"
37 # FIXME(shardy): Long term it'd be better if Heat SoftwareDeployments accepted
38 # list instead of a map, then we could join the lists of servers into one
39 # deployment instead of requiring one deployment per-role.
40 CollectMacDeploymentsController:
41 type: OS::Heat::SoftwareDeployments
43 name: CollectMacDeploymentsController
44 servers: {get_param: controller_servers}
45 config: {get_resource: CollectMacConfig}
46 actions: ['CREATE'] # Only do this on CREATE
48 CollectMacDeploymentsCompute:
49 type: OS::Heat::SoftwareDeployments
51 name: CollectMacDeploymentsCompute
52 servers: {get_param: compute_servers}
53 config: {get_resource: CollectMacConfig}
54 actions: ['CREATE'] # Only do this on CREATE
56 CollectMacDeploymentsBlockStorage:
57 type: OS::Heat::SoftwareDeployments
59 name: CollectMacDeploymentsBlockStorage
60 servers: {get_param: blockstorage_servers}
61 config: {get_resource: CollectMacConfig}
62 actions: ['CREATE'] # Only do this on CREATE
64 CollectMacDeploymentsObjectStorage:
65 type: OS::Heat::SoftwareDeployments
67 name: CollectMacDeploymentsObjectStorage
68 servers: {get_param: objectstorage_servers}
69 config: {get_resource: CollectMacConfig}
70 actions: ['CREATE'] # Only do this on CREATE
72 CollectMacDeploymentsCephStorage:
73 type: OS::Heat::SoftwareDeployments
75 name: CollectMacDeploymentsCephStorage
76 servers: {get_param: cephstorage_servers}
77 config: {get_resource: CollectMacConfig}
78 actions: ['CREATE'] # Only do this on CREATE
80 # Now we distribute all-the-macs to all nodes
82 type: OS::Heat::SoftwareConfig
86 - name: controller_mappings
87 - name: compute_mappings
88 - name: blockstorage_mappings
89 - name: objectstorage_mappings
90 - name: cephstorage_mappings
93 echo $controller_mappings > /root/controller_mappings
94 echo $compute_mappings > /root/compute_mappings
95 echo $blockstorage_mappings > /root/blockstorage_mappings
96 echo $objectstorage_mappings > /root/objectstorage_mappings
97 echo $cephstorage_mappings > /root/cephstorage_mappings
98 echo "mappings = $(cat /root/*_mappings)"
100 DistributeMacDeploymentsController:
101 type: OS::Heat::SoftwareDeployments
103 name: DistributeMacDeploymentsController
104 servers: {get_param: controller_servers}
105 config: {get_resource: DistributeMacConfig}
107 # FIXME(shardy): It'd be more convenient if we could join these
108 # items together but because the returned format is a map (not a list)
109 # we can't use list_join or str_replace. Possible Heat TODO.
110 controller_mappings: {get_attr: [CollectMacDeploymentsController, deploy_stdouts]}
111 compute_mappings: {get_attr: [CollectMacDeploymentsCompute, deploy_stdouts]}
112 blockstorage_mappings: {get_attr: [CollectMacDeploymentsBlockStorage, deploy_stdouts]}
113 objectstorage_mappings: {get_attr: [CollectMacDeploymentsObjectStorage, deploy_stdouts]}
114 cephstorage_mappings: {get_attr: [CollectMacDeploymentsCephStorage, deploy_stdouts]}
115 actions: ['CREATE'] # Only do this on CREATE