Ansible: Is it possible to "cat file" and export it's output to screen while playing a playbook and not as debug?
The quote Jinja filter should solve the quoting problem. Use it like this:
- debug: msg="{{ details.stdout_lines | quote }}"
For the other question, I am not aware of a module to print statements other than the debug
module. You might want to check if Save registered variable to file is an option. If you want to store Ansible variables on the controller host it is possible to do something like this:
- local_action: copy content={{ details.stdout_lines }} dest=/path/to/destination/file
EDIT I need to correct myself a bit. Take a look at this serverfault question. You can tweak the Ansible output by using the callback.display
function. I recommend reading the linked blog post.