{% set rabbitmq_server__tpl_accounts_vhosts = [] %}
{% for account in lookup("flattened", rabbitmq_server__combined_accounts) %}
{%   if account.vhost|d() and account.state|d('present') != 'absent' %}
{%     set _ = rabbitmq_server__tpl_accounts_vhosts.append({ 'name': account.vhost }) %}
{%   endif %}
{%   if account.node|d() %}
{%     set _ = rabbitmq_server__tpl_accounts_vhosts.append({ 'node': account.node }) %}
{%   endif %}
{%   if account.tracing|d() %}
{%     set _ = rabbitmq_server__tpl_accounts_vhosts.append({ 'tracing': account.tracing }) %}
{%   endif %}
{% endfor %}
{{ rabbitmq_server__tpl_accounts_vhosts }}
