Hello Jon - Thanks for the help! The change you suggested did help clean it up a bit. It changed it from a list output to one line string separated by literal '\n'. Something like "2a3\n> echo hi". This was a step in the right direction.
I did some more digging around and found an answer using Jinja2 whitespace control <http://jinja.pocoo.org/docs/dev/templates/#whitespace-control>. Uses a for loop to parse the list output via jinja2 filters. *Updated Code Snippet:* - name: Log diff changes blockinfile: dest: "{{ log_dir }}/{{ pb_diff_logname }}" content: | {{ app_log_header }} Command: 'diff {{ deployed_copy_output.dest }} {{ deployed_copy_output.backup_file }}' {% for item in diff_output.stdout_lines %} {{ item }} {% endfor %} {{ app_log_footer }} create: yes insertafter: EOF marker: "{{ app_log_marker }}" The output is then quite clean in the log file. > ********** > Command: 'diff /opt/wmspt/.profile > /opt/wmspt/.profile.2016-12-29@08:57:50~' > 2a3 > > echo hi > ********** Thanks! On Thursday, December 29, 2016 at 1:14:04 AM UTC-6, J Hawkesworth wrote: > > Try using join, like this > > {{ results.stdout_lines | join ('\n') }} > > Not tried, but hope it helps, > > Jon > > -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/5fd8619c-d23c-4bd5-ba1d-10a9ed69fe53%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
