Update the template_version alias for all the templates to pike.
[apex-tripleo-heat-templates.git] / puppet / extraconfig / pre_deploy / per_node.yaml
1 heat_template_version: pike
2
3 description: Configure hieradata overrides for specific nodes
4
5 parameters:
6   server:
7     description: ID of the controller node to apply this config to
8     type: string
9
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:
14   #      parameter_defaults:
15   #        NodeDataLookup: |
16   #          {"AB4114B1-9C9D-409A-BEFB-D88C151BF2C3": {"foo": "bar"},
17   #           "8CF1A7EA-7B4B-4433-AC83-17675514B1B8": {"foo2": "bar2"}}
18   NodeDataLookup:
19     type: string
20     default: ''
21     description: json string containing per-node configuration map
22
23 resources:
24   NodeSpecificConfig:
25     type: OS::Heat::SoftwareConfig
26     properties:
27       group: script
28       inputs:
29       - name: node_lookup
30       config: |
31         #!/bin/sh
32         node_id=$(dmidecode --s system-uuid)
33
34         # Create a /etc/puppet/hieradata/UUID.json file to provide
35         # the data of the NodeDataLookup parameter that matches the
36         # system UUID
37         echo $node_lookup | python -c "
38         import json
39         import sys
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
44
45   NodeSpecificDeployment:
46     type: OS::Heat::SoftwareDeployment
47     properties:
48       name: NodeSpecificDeployment
49       config: {get_resource: NodeSpecificConfig}
50       server: {get_param: server}
51       input_values:
52         node_lookup: {get_param: NodeDataLookup}
53
54 outputs:
55   deploy_stdout:
56     description: Deployment reference, used to trigger puppet apply on changes
57     value: {get_attr: [NodeSpecificDeployment, deploy_stdout]}