| {#- 'infra_config_classes' list object is dynamically generated from 'roles' to add on the cfg node #} |
| {%- set infra_config_classes = [] %} |
| {#- 'global_metadata' is a global collection of objects shared between nodes #} |
| {%- set global_metadata = {} %} |
| {%- set common_roles = ['_linux_network_interface', '_metadata_process', '_classes', '_overrides'] %} |
| parameters: |
| _param: |
| _esc: $ |
| reclass: |
| storage: |
| node: |
| {%- for inventory_node_name, node in nodes.items()|sort %} |
| {%- set node_name = inventory_node_name.split('.')[0] %} |
| |
| {{ node['reclass_storage_name'] }}: |
| {#-#} |
| {#- 'local_metadata' is to collect the data from different roles in a single place inside the node #} |
| {%- set local_metadata = {} %} |
| {#- 'params' dict object is dynamically generated from 'roles' to add on the node #} |
| {%- set params = {} %} |
| {#-#} |
| {%- macro register_metaparam(param_name, role_name) %} |
| {#- Add the <role_name> into the list attached to <param_name> #} |
| {#- to control that the <param_name> is not spreaded across incompatible roles #} |
| {%- set _ = local_metadata.update({param_name: local_metadata.get(param_name, []) + [role_name]}) %} |
| {%- endmacro %} |
| {#-#} |
| {%- macro set_param(param_name, param_value) %} |
| {#- Set a parameter for '_param' dict for the node #} |
| {%- set _ = params.update({param_name: param_value}) %} |
| {%- endmacro %} |
| {#-#} |
| classes: |
| {#- Common dynamic roles are added to each node #} |
| {#- 'overrides' must be the very last role for each node #} |
| {%- for role in node.get('roles', []) + common_roles %} |
| {%- include ("{# roles #}/" + role) %} |
| {%- endfor %} |
| |
| {%- if params %} |
| params: |
| {%- for param_name, param in params.items() %} |
| {{ param_name }}: {{ param }} |
| {%- endfor %} |
| {%- endif %} |
| name: {{ node_name }} |
| domain: ${_param:cluster_domain} |
| {%- endfor %} |
| |
| classes: |
| # Enable root and *ALL* users access |
| - system.openssh.server.team.all |
| {%- for infra_config_class in infra_config_classes %} |
| - {{ infra_config_class }} |
| {%- endfor %} |