{% macro print_comment(comment) %}
{%   if (comment | regex_replace('\n$','')).split('\n') | count == 1 %}
{{ comment | regex_replace('\n$','') | comment('plain', decoration='// ', prefix='', postfix='') -}}
{%   else %}
{{ comment | regex_replace('\n$','') | comment('plain', decoration=' * ', prefix='/**', postfix=' */\n') -}}
{%   endif %}
{% endmacro %}
{{ print_comment(ansible_managed) }}
{% if item.comment|d() %}
{{ print_comment(item.comment) -}}
{% endif %}
{% if item.options|d() %}
{%   for element in item.options %}
{%     if element.value|d() and element.state|d('present') not in [ 'absent', 'ignore' ] %}
{%       if (not loop.first or (loop.first and item.comment|d())) %}

{%       endif %}
{%       if element.comment|d() %}
{{ print_comment(element.comment) -}}
{%       endif %}
{%       if element.state|d('present') == 'comment' %}
/*
{%       endif %}
{{ element.value | regex_replace('\n$','') }}
{%       if element.state|d('present') == 'comment' %}
*/
{%       endif %}
{%     endif %}
{%   endfor %}
{% endif %}
{% if item.value|d() %}
{%   if item.state|d('present') == 'comment' %}
/*
{%   endif %}
{{ item.value | regex_replace('\n$','') }}
{%   if item.state|d('present') == 'comment' %}
*/
{%   endif %}
{% endif %}
