Deep scan config

This commit is contained in:
Bahadır Kandemir 2015-10-10 00:58:08 +03:00
parent 53cee1b3cd
commit 63c49d7431

View file

@ -4,8 +4,16 @@
{% for service in consul.register %} {% for service in consul.register %}
{ {
{% for key, value in service.items() %} {% for key, value in service.items() %}
{% if key == 'script' %} {% if key == 'checks' %}
"{{ script }}": "/opt/consul/scripts/"{{ value.split('/')[-1] }}{% if not loop.last %},{% endif %} "checks": [
{% for key2, value2 in value.items() %}
{% if key2 == 'script' %}
"script": /opt/consul/scripts/{{ value2.split('/')[-1] }}{% if not loop.last %},{% endif %}
{% else %}
"{{ key2 }}": {{ value2 | json}}{% if not loop.last %},{% endif %}
{% endif %}
{% endfor %}
]{% if not loop.last %},{% endif %}
{% else %} {% else %}
"{{ key }}": {{ value | json}}{% if not loop.last %},{% endif %} "{{ key }}": {{ value | json}}{% if not loop.last %},{% endif %}
{% endif %} {% endif %}