blob: f80388871ee503fbfeca5b31fad9b6c63a8c43a9 [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] %}
Dennis Dmitrievf4826bc2017-09-28 19:03:54 +030015
Dennis Dmitrievcf5f43b2017-10-11 15:10:27 +030016 {{ node['reclass_storage_name'] }}:
17 {#-#}
Dennis Dmitrievf4826bc2017-09-28 19:03:54 +030018 {#- 'local_metadata' is to collect the data from different roles in a single place inside the node #}
19 {%- set local_metadata = {} %}
20 {#- 'params' dict object is dynamically generated from 'roles' to add on the node #}
21 {%- set params = {} %}
Dennis Dmitrievcf5f43b2017-10-11 15:10:27 +030022 {#-#}
Dennis Dmitrievf4826bc2017-09-28 19:03:54 +030023 {%- macro register_metaparam(param_name, role_name) %}
24 {#- Add the <role_name> into the list attached to <param_name> #}
25 {#- to control that the <param_name> is not spreaded across incompatible roles #}
26 {%- set _ = local_metadata.update({param_name: local_metadata.get(param_name, []) + [role_name]}) %}
27 {%- endmacro %}
Dennis Dmitrievcf5f43b2017-10-11 15:10:27 +030028 {#-#}
Dennis Dmitrievf4826bc2017-09-28 19:03:54 +030029 {%- macro set_param(param_name, param_value) %}
30 {#- Set a parameter for '_param' dict for the node #}
31 {%- set _ = params.update({param_name: param_value}) %}
32 {%- endmacro %}
Dennis Dmitrievcf5f43b2017-10-11 15:10:27 +030033 {#-#}
Dennis Dmitrievf4826bc2017-09-28 19:03:54 +030034 classes:
35 {#- Default roles are added to each node #}
36 {#- 'overrides' must be the very last role for each node #}
37 {%- for role in node.get('roles', []) + common_roles %}
38 {%- include ("{# roles #}/" + role) %}
39 {%- endfor %}
40
41 {%- if params %}
42 params:
43 {%- for param_name, param in params.items() %}
44 {{ param_name }}: {{ param }}
45 {%- endfor %}
46 {%- endif %}
47 name: {{ node_name }}
48 domain: ${_param:cluster_domain}
49 {%- endfor %}
50
51classes:
52# Enable root and *ALL* users access
53- system.openssh.server.team.all
54{%- for infra_config_class in infra_config_classes %}
55- {{ infra_config_class }}
56{%- endfor %}