<div dir="ltr"><div>thanks for heads up.<br></div>suggest we add this to the kolla docs as is easy to forget about it<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Sep 13, 2016 at 3:15 AM, Jeffrey Zhang <span dir="ltr"><<a href="mailto:zhang.lei.fly@gmail.com" target="_blank">zhang.lei.fly@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">When using ansible template module, you may see the trailing newline<br>
is stripped by blocks, like<br>
<br>
# template.j2<br>
a = {% if true %}1{% endfor %}<br>
b = 2<br>
<br>
the render will be like<br>
<br>
a=1b=2<br>
<br>
The newline character after `a=1` is stripped.<br>
<br>
The root cause comes from jinja2's trim_blocks feature. Ansible<br>
enabled this feature. If you want to disable it, just add `#jinja2:<br>
trim_blocks: False` to the j2 template file. This is a feature in<br>
Ansible, and I do not think they will fix/change this. But we need<br>
take care of this when using the template module.<br>
<br>
More info please check[0][1]<br>
<br>
[0] <a href="https://github.com/ansible/ansible/issues/16344" rel="noreferrer" target="_blank">https://github.com/ansible/<wbr>ansible/issues/16344</a><br>
[1] <a href="http://jinja.pocoo.org/docs/dev/api/#jinja2.Environment" rel="noreferrer" target="_blank">http://jinja.pocoo.org/docs/<wbr>dev/api/#jinja2.Environment</a><br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Regards,<br>
Jeffrey Zhang<br>
Blog: <a href="http://xcodest.me" rel="noreferrer" target="_blank">http://xcodest.me</a><br>
<br>
______________________________<wbr>______________________________<wbr>______________<br>
OpenStack Development Mailing List (not for usage questions)<br>
Unsubscribe: <a href="http://OpenStack-dev-request@lists.openstack.org?subject:unsubscribe" rel="noreferrer" target="_blank">OpenStack-dev-request@lists.<wbr>openstack.org?subject:<wbr>unsubscribe</a><br>
<a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev" rel="noreferrer" target="_blank">http://lists.openstack.org/<wbr>cgi-bin/mailman/listinfo/<wbr>openstack-dev</a><br>
</font></span></blockquote></div><br></div>