{% set i = 0 -%}
{% set section_name = {} %}
{% for line in conf -%}
{% set i = i + loop.index0 %}
{% if not role %}
{% if line.startswith('#HideBlockStart') %}
{% continue %}
{% endif %}
{% endif %}
{% if service == 'nginx' %}
{%- if "server {" in line -%}
{% if i > 1 %}
{% endif %}
{% continue %}
{% endif %}
{% if "listen " in line or "location" in line or "server_name" in line or "}" in line %}
{% if "#" not in line %}
{{ i }}
{{ line }}
{% continue %}
{% endif %}
{% endif %}
{% if "#" in line %}
{{ i }}
{% continue %}
{% endif %}
{% if line|length > 1 %}
{{ i }}
{{ line }}
{% endif %}
{% else %}
{% if line.startswith('global') %}
{{ line }}
{% if role %}
{% if service != 'keepalived' %}
Edit
{% endif %}
{% endif %}
{% continue %}
{% endif %}
{% if line.startswith('defaults') %}
{{ line }}
{% if role %}
Edit
{% endif %}
{% continue %}
{% endif %}
{%- if line.startswith('listen') -%}
{{- line -}}
{% if role %}
Edit/Delete
{% endif %}
{%- set backend = line.split(' ') -%}
Stats
{%- set backend = backend|join('_') -%}
{%- do section_name.update({i: backend}) -%}
{% continue %}
{%- endif -%}
{%- if line.startswith('frontend') -%}
{{ line }}
{% if role %}
Edit/Delete
{% endif %}
{% set backend = line.split(' ') %}
Stats
{% set backend = backend|join('_') %}
{% do section_name.update({i: backend}) %}
{% continue %}
{%- endif -%}
{% if line.startswith('backend') %}
{{ line }}
{% if role %}
Edit/Delete
{% endif %}
{% set backend = line.split(' ') %}
Stats
{% continue %}
{% endif %}
{% if line.startswith('cache') %}
{{ line }}
{% if role %}
Edit/Delete
{% endif %}
{% continue %}
{% endif %}
{% if line.startswith('peers') %}
{{ line }}
{% if role %}
Edit/Delete
{% endif %}
{% continue %}
{% endif %}
{% if line.startswith('resolvers') %}
{{ line }}
{% if role %}
Edit/Delete
{% endif %}
{% continue %}
{% endif %}
{% if line.startswith('userlist') %}
{{ line }}
{% if role %}
Edit/Delete
{% endif %}
{% continue %}
{% endif %}
{% if line.startswith('http-errors') %}
{{ line }}
{% if role %}
Edit/Delete
{% endif %}
{% continue %}
{% endif %}
{% if "acl" in line or "option" in line or "server" in line %}
{% if "timeout" not in line and "default-server" not in line and "#use_backend" not in line and "#" not in line%}
{{ i }}
{{ line }}
{% continue %}
{% endif %}
{% endif %}
{% if line.startswith("#") %}
{{ i }}
{% continue %}
{% endif %}
{% if line|length > 1 %}
{{ i }}
{{ line }}
{% endif %}
{%- if "bind" in line -%}
{%- set bind = line.split(':')[1] -%}
{%- set bind = bind.split(' ') -%}
{%- endif -%}
{%- endif -%}
{%- endfor -%}
{% if configver %}