Join list to string whitespace separated with Jinja2
---
- name: jedi
gather_facts: false
no_log: false
hosts: 127.0.0.1
tasks:
- name: Set facts
set_fact:
remove_packages:
- thunderbird
- firefox
- name: MSG Remove packages
debug: msg="{% if remove_packages -%} {{- remove_packages|join( ' ' ) -}} {%- endif %}"