2 # shellcheck disable=SC2034
3 ##############################################################################
4 # Copyright (c) 2018 Mirantis Inc., Enea AB and others.
5 # All rights reserved. This program and the accompanying materials
6 # are made available under the terms of the Apache License, Version 2.0
7 # which accompanies this distribution, and is available at
8 # http://www.apache.org/licenses/LICENSE-2.0
9 ##############################################################################
11 # Data derived from XDF (PDF/IDF/SDF/etc), used as input in deploy.sh
14 {%- set arch = conf[conf.MCP_JUMP_ARCH] -%}
16 {%- macro bash_arr(_l) -%}
17 ({%- for n in _l -%}'{{ n }}' {% endfor -%})
20 {#- Pack list as `sep`-separated string, replacing spaces with '|' -#}
21 {%- macro pack(x = [], sep = ',') -%}
22 {{ x | join(sep) | replace(' ', '|') }}
25 {#- Pack all vnode data as string -#}
26 {%- macro serialize_vnodes() -%}
27 {%- set V = conf.virtual -%}
29 {%- for n in V.nodes -%}
30 {%- if n not in V -%}{%- do V.update({n: {}}) -%}{%- endif -%}
31 {%- do arr.append(pack([n, V[n].ram or arch.default.ram,
32 V[n].vcpus or arch.default.vcpus])) -%}
34 '{{ pack(arr, '|') }}'
37 {#- Pack apt_pkg data as string -#}
38 {%- macro serialize_apt_pkg() -%}
40 {%- set sections = [arch.common] -%}
41 {%- if conf.MCP_VCP -%}
42 {%- do sections.append(arch.control) -%}
44 {%- for c in sections -%}
45 {%- do arr.append(pack([pack(c.apt['keys']), pack(c.apt.repos),
46 pack(c.pkg.install), pack(c.pkg.remove)], '^')) -%}
48 '{{ pack(arr, '^') }}'
51 {%- set bridges = conf.idf.fuel.jumphost.bridges %}
52 # Determine bridge names based on IDF, where all bridges are now mandatory
54 '{{ bridges.admin or "pxebr" }}'
55 '{{ bridges.mgmt or "mgmt" }}'
56 '{{ bridges.private or "internal" }}'
57 '{{ bridges.public or "public" }}'
60 export CLUSTER_DOMAIN={{ conf.cluster.domain }}
61 cluster_states={{ bash_arr(conf.cluster.states) }}
62 virtual_nodes={{ bash_arr(conf.virtual.nodes) }}
63 base_image={{ arch.base_image }}
65 # Serialize vnode data as '<name0>,<ram0>,<vcpu0>|<name1>,<ram1>,<vcpu1>[...]'
66 virtual_nodes_data={{ serialize_vnodes() }}
68 # Serialize repos, packages to (pre-)install/remove for:
69 # - foundation node VM base image (virtual: all VMs, baremetal: cfg01|mas01)
70 # - virtualized control plane VM base image (only when VCP is used)
71 virtual_repos_pkgs={{ serialize_apt_pkg() }}