{% set postfix__tpl_dependent_maincf = {} %}
{% if (postfix__register_dependent_maincf|d() and postfix__register_dependent_maincf.content|d()) %}
{%   set _ = postfix__tpl_dependent_maincf.update(postfix__register_dependent_maincf.content | b64decode | trim | from_json) %}
{% endif %}
{% if postfix__dependent_maincf %}
{%   set postfix__tpl_flattened_maincf = lookup('flattened', postfix__dependent_maincf) %}
{%   for element in ([ postfix__tpl_flattened_maincf ] if postfix__tpl_flattened_maincf is mapping else postfix__tpl_flattened_maincf) %}
{%     if element.role|d() and element.config|d() %}
{%       if element.state|d('present') not in [ 'ignore', 'absent' ] %}
{%         set flattened_config = lookup('flattened', element.config) %}
{%         set _ = postfix__tpl_dependent_maincf.update({
  element.role: ([ flattened_config ] if flattened_config is mapping else flattened_config)
}) %}
{%       elif element.state|d('present') == 'absent' %}
{%         set _ = postfix__tpl_dependent_maincf.pop(element.role, None) %}
{%       endif %}
{%     elif element is mapping and 'role' not in element.keys() and 'config' not in element.keys() %}
{%       for role, config in element.items() %}
{%         set flattened_config = lookup('flattened', config) %}
{%         set _ = postfix__tpl_dependent_maincf.update({
  role: ([ flattened_config ] if flattened_config is mapping else flattened_config)
}) %}
{%       endfor %}
{%     endif %}
{%   endfor %}
{% endif %}
{% set postfix__tpl_output_maincf = [] %}
{% for key, value in postfix__tpl_dependent_maincf.items() %}
{%   set _ = postfix__tpl_output_maincf.extend(value) %}
{% endfor %}
{{ postfix__tpl_output_maincf | to_yaml }}
