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 servers: {get_param: controller_servers}
44 config: {get_resource: CollectMacConfig}
45 actions: ['CREATE'] # Only do this on CREATE
47 CollectMacDeploymentsCompute:
48 type: OS::Heat::SoftwareDeployments
50 servers: {get_param: compute_servers}
51 config: {get_resource: CollectMacConfig}
52 actions: ['CREATE'] # Only do this on CREATE
54 CollectMacDeploymentsBlockStorage:
55 type: OS::Heat::SoftwareDeployments
57 servers: {get_param: blockstorage_servers}
58 config: {get_resource: CollectMacConfig}
59 actions: ['CREATE'] # Only do this on CREATE
61 CollectMacDeploymentsObjectStorage:
62 type: OS::Heat::SoftwareDeployments
64 servers: {get_param: objectstorage_servers}
65 config: {get_resource: CollectMacConfig}
66 actions: ['CREATE'] # Only do this on CREATE
68 CollectMacDeploymentsCephStorage:
69 type: OS::Heat::SoftwareDeployments
71 servers: {get_param: cephstorage_servers}
72 config: {get_resource: CollectMacConfig}
73 actions: ['CREATE'] # Only do this on CREATE
75 # Now we distribute all-the-macs to all nodes
77 type: OS::Heat::SoftwareConfig
81 - name: controller_mappings
82 - name: compute_mappings
83 - name: blockstorage_mappings
84 - name: objectstorage_mappings
85 - name: cephstorage_mappings
88 echo $controller_mappings > /root/controller_mappings
89 echo $compute_mappings > /root/compute_mappings
90 echo $blockstorage_mappings > /root/blockstorage_mappings
91 echo $objectstorage_mappings > /root/objectstorage_mappings
92 echo $cephstorage_mappings > /root/cephstorage_mappings
93 echo "mappings = $(cat /root/*_mappings)"
95 DistributeMacDeploymentsController:
96 type: OS::Heat::SoftwareDeployments
98 servers: {get_param: controller_servers}
99 config: {get_resource: DistributeMacConfig}
101 # FIXME(shardy): It'd be more convenient if we could join these
102 # items together but because the returned format is a map (not a list)
103 # we can't use list_join or str_replace. Possible Heat TODO.
104 controller_mappings: {get_attr: [CollectMacDeploymentsController, deploy_stdouts]}
105 compute_mappings: {get_attr: [CollectMacDeploymentsCompute, deploy_stdouts]}
106 blockstorage_mappings: {get_attr: [CollectMacDeploymentsBlockStorage, deploy_stdouts]}
107 objectstorage_mappings: {get_attr: [CollectMacDeploymentsObjectStorage, deploy_stdouts]}
108 cephstorage_mappings: {get_attr: [CollectMacDeploymentsCephStorage, deploy_stdouts]}
109 actions: ['CREATE'] # Only do this on CREATE
112 # This value should change if the configuration data has changed
113 # It is used to e.g re-apply puppet after hieradata values change.
115 value: {get_attr: [DistributeMacDeploymentsController, deploy_stdouts]}