-
Notifications
You must be signed in to change notification settings - Fork 253
/
cluster_template.j2
47 lines (42 loc) · 1.81 KB
/
cluster_template.j2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
{
"blueprint" : "{{ blueprint_name }}",
"config_recommendation_strategy" : "{{ config_recommendation_strategy }}",
{% if ambari_version is version_compare('2.6', '>=') %}
"repository_version_id": "{{ vdf_id }}",
{% endif %}
"default_password" : "{{ default_password }}",
{% if security|lower != "none" %}
"credentials" : [
{
"alias" : "kdc.admin.credential",
{% if security|lower == "mit-kdc" %}
"principal" : "{{ security_options.admin_principal }}/admin@{{ security_options.realm | upper }}",
{% else %}
"principal" : "{{ security_options.admin_principal }}@{{ security_options.realm | upper }}",
{% endif %}
"key" : "{{ security_options.admin_password }}",
"type" : "TEMPORARY"
}
],
"security" : {
"type" : "KERBEROS"
},
{% endif %}
{#
The following attempts to find out the Ansible groups that map on the blueprint's host_groups.
When using a dynamic blueprint this should work fine as it knows the host_groups from the 'blueprint_dynamic' variable.
When using a static blueprint, this might sometimes fail, as it simply does the regex check in the blueprint's content.
#}
"host_groups" :[
{% for group in groups|sort if group not in ['all', 'ungrouped'] and groups[group]|length > 0 and (blueprint_file == 'blueprint_dynamic.j2' and group in blueprint_dynamic|map(attribute='host_group')|list) or (blueprint_file != 'blueprint_dynamic.j2' and blueprint_static['host_groups'] | string is search(group)) %}
{
"name" : "{{ group }}",
"hosts" : [
{% for node in groups[group]|sort -%}
{ "fqdn" : "{{ hostvars[node]['ansible_fqdn'] | lower }}", "rack_info": "{{ hostvars[node]['rack'] | default('/default-rack') }}" }{% if not loop.last %},{% endif %}
{% endfor %}
]
}{% if not loop.last %},{% endif %}
{% endfor %}
]
}