Ansible - Print Message - Debug: Msg="line1 \n {{ Var2 }} \n Line3 With Var3 = {{ Var3 }}"
Answer : debug module support array, so you can do like this: debug: msg: - "First line" - "Second line" The output: ok: [node1] => { "msg": [ "First line", "Second line" ] } Or you can use the method from this answer: In YAML, how do I break a string over multiple lines? The most convenient way I found to print multi-line text with debug is: - name: Print several lines of text vars: msg: | This is the first line. This is the second line with a variable like {{ inventory_hostname }}. And here could be more... debug: msg: "{{ msg.split('\n') }}" It splits the message up into an array and debug prints each line as a string. The output is: ok: [example.com] => { "msg": [ "This is the first line.", "This is the second line with a variable like example.com", "And...