1 heat_template_version: 2015-04-30
3 description: Configure hieradata overrides for specific nodes
7 description: ID of the controller node to apply this config to
10 # Config specific parameters, to be provided via parameter_defaults
11 # This would be a lookup of the node UUID as provided by dmidecode
12 # to the json required for the node-specific hieradata
13 # Note this needs to be a json blob e.g:
16 # {"AB4114B1-9C9D-409A-BEFB-D88C151BF2C3": {"foo": "bar"},
17 # "8CF1A7EA-7B4B-4433-AC83-17675514B1B8": {"foo2": "bar2"}}
21 description: json string containing per-node configuration map
25 type: OS::Heat::SoftwareConfig
32 node_id=$(dmidecode --s system-uuid)
34 # Create a /etc/puppet/hieradata/UUID.json file to provide
35 # the data of the NodeDataLookup parameter that matches the
37 echo $node_lookup | python -c "
40 input = sys.stdin.readline() or '{}'
41 cnt = json.loads(input)
42 print json.dumps(cnt.get('${node_id}', {}))
43 " > /etc/puppet/hieradata/${node_id}.json
45 NodeSpecificDeployment:
46 type: OS::Heat::SoftwareDeployment
48 config: {get_resource: NodeSpecificConfig}
49 server: {get_param: server}
51 node_lookup: {get_param: NodeDataLookup}
55 description: Deployment reference, used to trigger puppet apply on changes
56 value: {get_attr: [NodeSpecificDeployment, deploy_stdout]}