title: Conditional text in jinja2 templates for ansible
body: <p>I have playbook which may set lot of options for the daemon command line. I want to allow set them all from variables, but the same time I want to make them all optional.</p>
  
  <p>Now I have template (j2) with all variables mandatory:</p>
  
  <pre><code>{% for router in flowtools.captures %}
  -d {{router.debug_level}} -e {{router.expire_count}} -E {{router.expire_size}} -f {{router.fiter_name}} -F {{router.filter_definition}} -n {{router.rotations}} -N {{router.netsting_level}} -S {{router.start_interval}} -t {{router.tag_name}} -T {{router.active_def}} -V {{pdu_version}} -w {{router.workdir}} -x {{router.xlate_fname}} -z {{router.z_level}}
  {% endfor %}
  </code></pre>
  
  <p>I want:</p>
  
  <ul>
  <li>To allow undefined variables in 'router' (without failing a playbook).</li>
  <li>Not to include option (-z, -b, etc) to the output if related variable is empty.</li>
  </ul>
  
  <p>For example above, if flowtools.captures[0] contains only debug_level=2 and workdir=/tmp it should generate:</p>
  
  <p>-d 2 -w /tmp.</p>
  
  <p>I can add huge list of {% if %}'s but this would be very bulky. Is it possible to make it gracefully? </p>