How to remove the line breaker character ‘\n’ from the result of lookup() module in Ansible? May 20, 2023 by Tarik Use the Jinja trim filter: "{{ lookup('file', 'foo.xml' ) | trim }}"