#{{ ansible_managed }}
frontend {{ item.name }} {{ item.ip }}{%if item.port is defined %}:{{ item.port }}{% endif %}

    {% if item.maxconn is defined -%}
        maxconn {{ item.maxconn }}
    {% endif -%}

    {%- if item.monitor is defined -%}
       {% if item.monitor.uri is defined -%}
            monitor-uri {{ item.monitor.uri }}
       {% endif %}
       {%- if item.monitor.fail is defined -%}
         {%- for condition in item.monitor.fail -%}
            monitor fail {{ condition }}
         {% endfor %}
       {% endif %}
    {% endif -%}

    {%- if item.acl is defined -%}
       {%- for acl in item.acl -%}
         acl {{ acl.name }} {{ acl.condition }}
       {% endfor %}
    {% endif -%}

    {%- if item.rate_limit_sessions is defined -%}
        rate-limit sessions {{ item.rate_limit_sessions }}
    {% endif %}
    {%- if item.block is defined -%}
        {%- for block in item.block -%}
            block {{ block }}
        {% endfor %}
    {% endif -%}

    default_backend {{ item.default_backend }}

    {%- if item.backends is defined -%}
        {% for backend in item.backends %}
            use_backend {{ backend.name }} {{ backend.condition }}
        {% endfor %}
    {% endif -%}


#{{ ansible_managed }}
frontend {{ item.name }} {%if item.ip is defined %}{{ item.ip }}{% endif %}{%if item.port is defined %}:{{ item.port }}{% endif %}

    {% if item.bind is defined -%}
        bind {{ item.bind }}
    {% endif -%}

    {% if item.maxconn is defined -%}
        maxconn {{ item.maxconn }}
    {% endif -%}

    {%- if item.monitor is defined -%}
       {% if item.monitor.uri is defined -%}
            monitor-uri {{ item.monitor.uri }}
       {% endif %}
       {%- if item.monitor.fail is defined -%}
         {%- for condition in item.monitor.fail -%}
            monitor fail {{ condition }}
         {% endfor %}
       {% endif %}
    {% endif -%}

    {%- if item.acl is defined -%}
       {%- for acl in item.acl -%}
         acl {{ acl.name }} {{ acl.condition }}
       {% endfor %}
    {% endif -%}

    {%- if item.rate_limit_sessions is defined -%}
        rate-limit sessions {{ item.rate_limit_sessions }}
    {% endif %}
    {%- if item.block is defined -%}
        {%- for block in item.block -%}
            block {{ block }}
        {% endfor %}
    {% endif -%}

    default_backend {{ item.default_backend }}

    {%- if item.backends is defined -%}
        {% for backend in item.backends %}
            use_backend {{ backend.name }} {{ backend.condition }}
        {% endfor %}
    {% endif -%}


Allow bind to be set, and make ip optional
Allow bind to be set, and make ip optional