Joined this group just to give you a shout out Matt, all became clear as
soon as I read your reply.
Thanks man, you rock,
Ioan
On Monday, June 29, 2015 at 7:55:48 PM UTC+1, Matt Martz wrote:
>
> The problem from what I can remember is that ansible does not specify
> lstrip_blocks, and as such, it can cause indentation issues.
>
> The approach I take, it to left justify all jinja2 control blocks. So all
> {% %} lines would have no indentation, only the lines inside would be
> indented.
>
> such as:
>
> {% for http in datadog_http_checks %}
> - name: {{ http.name }}
> {% if http.url is defined -%}
> url: {{ http.url }}
> {% endif -%}
> ...
> {% endfor %}
>
> On Mon, Jun 29, 2015 at 1:46 PM, Nicolas G <[email protected]
> <javascript:>> wrote:
>
>> Hi,
>>
>> I have the bellow vars to populate a template , it works almost fine but
>> the final file result you can see there is some indentation problem :
>>
>>
>> # vars :
>> datadog_http_checks:
>> - name : mycheck
>> url : http://localhost:9090/hc/
>> threshold : 5
>> window : 5
>> timeout : 1
>>
>>
>> # template:
>> init_config:
>>
>> instances:
>> {% for http in datadog_http_checks %}
>> - name: {{ http.name }}
>> {% if http.url is defined -%}
>> url: {{ http.url }}
>> {% endif -%}
>> {% if http.threshold is defined -%}
>> threshold: {{ http.threshold }}
>> {% endif %}
>> {% if http.window is defined -%}
>> window: {{ http.window }}
>> {% endif %}
>> {% if http.timeout is defined -%}
>> timeout: {{ http.timeout }}
>> {% endif %}
>> {% if http.include_content is defined -%}
>> include_content: {{ http.include_content }}
>> {% endif %}
>> notify:
>> - pagerduty
>>
>> {% endfor %}
>>
>>
>> # result :
>> instances:
>> - name: mycheck
>> url: http://localhost:9090/hc/
>> threshold: 5
>> window: 5
>> timeout: 1
>> notify:
>> - pagerduty
>>
>>
>> Is this a bug or am I doing something wrong ?
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Ansible Project" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected] <javascript:>.
>> To post to this group, send email to [email protected]
>> <javascript:>.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/ansible-project/5e7c16ad-ce87-4db9-add6-a1d600f5b2bb%40googlegroups.com
>>
>> <https://groups.google.com/d/msgid/ansible-project/5e7c16ad-ce87-4db9-add6-a1d600f5b2bb%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
> Matt Martz
> @sivel
> sivel.net
>
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/f2feed29-9bd9-4409-bcfd-bb98ee99bae1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.