1 ##############################################################################
2 # Copyright (c) 2016 Ericsson AB and others.
3 # peter.barabas@ericsson.com
4 # All rights reserved. This program and the accompanying materials
5 # are made available under the terms of the Apache License, Version 2.0
6 # which accompanies this distribution, and is available at
7 # http://www.apache.org/licenses/LICENSE-2.0
8 ##############################################################################
10 ======== TEMPLATING SUPPORT IN YAML CONFIGURATION FILES ========
12 deploy/templater.py makes it possible to use templates to generate configuration
13 files. It takes 2 input YAML files and an output file as arguments. One being
14 the dictionary (called the base file), which is used to look up values in; the
15 other file is the template, where the substitution will take place. Templater
16 will write the result to an output file, specified as the 3rd argument.
19 ======== SYNTAX OF TEMPLATE FILES ========
21 A template file can contain any valid YAML data and template variables, whose
22 syntax is described below:
24 1. Single value references
28 %{environment/net_segment_type}
30 Either a root element, or a path can be specified.
36 %{network/networking_parameters}
38 Either a root element, or a path can be specified.
40 3. Interface lookup for network
44 Specify a network type as argument to interface().
46 4. Interface lookup for network and role
48 %{interface(public,compute)}
50 Specify a network type and a role as arguments to interface().
53 ======== EXAMPLES ========
55 Base YAML file (excerpt):
57 title: Deployment Environment Adapter (DEA)
59 created: Wed Mar 30 08:16:04 2016
63 wanted_release: Liberty on Ubuntu 14.04
66 interfaces: interfaces_1
67 role: ceph-osd,compute
68 transformations: transformations_1
70 interfaces: interfaces_1
71 role: ceph-osd,compute
72 transformations: transformations_1
74 interfaces: interfaces_1
75 role: ceph-osd,compute
76 transformations: transformations_1
78 interfaces: interfaces_2
79 role: controller,mongo
80 transformations: transformations_2
82 interfaces: interfaces_2
83 role: controller,mongo
84 transformations: transformations_2
86 interfaces: interfaces_2
87 role: controller,mongo
88 transformations: transformations_2
109 - cidr: 172.16.0.0/24
117 floating_range_var: floating_ranges
124 render_addr_mask: public
133 - cidr: 192.168.1.0/24
144 render_addr_mask: storage
156 deployment-scenario-metadata:
161 net_segment_type: %{environment/net_segment_type}
168 deployment-scenario-metadata:
169 title: Deployment Environment Adapter (DEA)
173 net_segment_type: tun
176 interfaces: interfaces_1
177 role: ceph-osd,compute
178 transformations: transformations_1
180 interfaces: interfaces_1
181 role: ceph-osd,compute
182 transformations: transformations_1
184 interfaces: interfaces_1
185 role: ceph-osd,compute
186 transformations: transformations_1
188 interfaces: interfaces_2
189 role: controller,mongo
190 transformations: transformations_2
192 interfaces: interfaces_2
193 role: controller,mongo
194 transformations: transformations_2
196 interfaces: interfaces_2
197 role: controller,mongo
198 transformations: transformations_2
216 - cidr: 172.16.0.0/24
224 floating_range_var: floating_ranges
231 render_addr_mask: public
240 - cidr: 192.168.1.0/24
251 render_addr_mask: storage
263 storage_if: %{interface(storage)}
264 compute_private_if: %{interface(private,compute)}
265 # Management interface of a mongo node
266 mongo_mgmt_if: %{interface(management,mongo)}
267 controller_private_if: %{interface(private,controller)}
273 compute_private_if: ens5
274 # Management interface of a mongo node
276 controller_private_if: ens4