blob: 89db66fd18e56f989ce10dd22b75173b48c2cc47 [file] [log] [blame]
Dennis Dmitrievf4826bc2017-09-28 19:03:54 +03001{# 'infra_config_classes' list object is dynamically generated from 'roles' to add on the cfg node #}
2{%- set infra_config_classes = [] %}
3{# 'global_metadata' is a global collection of objects shared between nodes #}
4{%- set global_metadata = {} %}
5{%- set common_roles = ['_linux_network_interface', '_metadata_process', '_overrides'] %}
6
7parameters:
8 _param:
9 _esc: $
10 reclass:
11 storage:
12 node:
13 {%- for inventory_node_name, node in nodes.items()|sort %}
14 {%- set node_name = inventory_node_name.split('.')[0] %}
15 {{ node['reclass_storage_name'] }}:
16
17 {#- 'local_metadata' is to collect the data from different roles in a single place inside the node #}
18 {%- set local_metadata = {} %}
19 {#- 'params' dict object is dynamically generated from 'roles' to add on the node #}
20 {%- set params = {} %}
21
22 {%- macro register_metaparam(param_name, role_name) %}
23 {#- Add the <role_name> into the list attached to <param_name> #}
24 {#- to control that the <param_name> is not spreaded across incompatible roles #}
25 {%- set _ = local_metadata.update({param_name: local_metadata.get(param_name, []) + [role_name]}) %}
26 {%- endmacro %}
27
28 {%- macro set_param(param_name, param_value) %}
29 {#- Set a parameter for '_param' dict for the node #}
30 {%- set _ = params.update({param_name: param_value}) %}
31 {%- endmacro %}
32
33 classes:
34 {#- Default roles are added to each node #}
35 {#- 'overrides' must be the very last role for each node #}
36 {%- for role in node.get('roles', []) + common_roles %}
37 {%- include ("{# roles #}/" + role) %}
38 {%- endfor %}
39
40 {%- if params %}
41 params:
42 {%- for param_name, param in params.items() %}
43 {{ param_name }}: {{ param }}
44 {%- endfor %}
45 {%- endif %}
46 name: {{ node_name }}
47 domain: ${_param:cluster_domain}
48 {%- endfor %}
49
50classes:
51# Enable root and *ALL* users access
52- system.openssh.server.team.all
53{%- for infra_config_class in infra_config_classes %}
54- {{ infra_config_class }}
55{%- endfor %}