{% from "consul/map.jinja" import consul with context %} { "services": [ {% for service in consul.register %} { {% for key, value in service.items() %} {% if key == 'script' %} "{{ script }}": "/opt/consul/scripts/"{{ value.split('/')[-1] }}{% if not loop.last %},{% endif %} {% else %} "{{ key }}": {{ value | json}}{% if not loop.last %},{% endif %} {% endif %} {% endfor %} }{% if not loop.last %},{% endif %} {% endfor %} ] }