title: how to append to a list in jinja2 for ansible
body: <p>Below is the jinja2 template that i wrote to use in ansible.</p>
  
  <pre><code>{% set port = 1234 %}
  {% set server_ip = [] %}
  {% for ip in host_ip  %}
  {% do server_ip.append({{ ip }}:{{ port }}) %}
  {% endfor %}
  {% server_ip|join(', ') %}
  </code></pre>
  
  <p>Below is the my desired output:</p>
  
  <pre><code>devices = 192.168.56.14:1234,192.168.56.13:1234,192.168.56.10:1234
  </code></pre>
  
  <p>But when i am running the ansible playbook, it is throwing the error as below:</p>
  
  <pre><code>"AnsibleError: teme templating string: Encountered unknown tag 'do'. Jinja was looking for th: 'endfor' or 'else'
  </code></pre>
  
  <p>Any help would be appreciated..</p>