Working with lists in Jinja2 is really simple if you are using the following trick.
{%- set vfs_objects = [] %} {%- if share.recyclebin | to_bool %} {%- set _ = vfs_objects.append('recycle') %} ... {%- endif %} {%- if share.audit | to_bool %} {%- set _ = vfs_objects.append('full_audit') %} ... {%- endif %} vfs objects = {{ vfs_objects | join(' ') }}