Hello - Assistance requested with stdout_lines output.
I have some tasks that take diff results of two files and then writes the
output to a log.
Code Snippet:
- name: Gather diff output of deployed changes
command: "diff {{ deployed_copy_output.dest }} {{
deployed_copy_output.backup_file }}"
register: diff_output
failed_when: diff_output.rc > 1
- 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 }}'
{{ diff_output.stdout_lines }}
{{ app_log_footer }}
create: yes
insertafter: EOF
marker: "{{ app_log_marker }}"
This results in output that looks like the below.
> **********
> Command: 'diff /opt/wmspt/.profile
> /opt/wmspt/.profile.2016-12-28@23:06:41~'
> [u'2a3', u'> echo hi']
> **********
I would expect it to look more like the debug output:
> TASK [role_config_shared_profile : debug]
> **************************************
> ok: [ptl01a0fap006] => {
> "diff_output": {
> "changed": false,
> "cmd": [
> "diff",
> "/opt/wmspt/.profile",
> "/opt/wmspt/.profile.2016-12-28@23:27:24~"
> ],
> "delta": "0:00:00.111675",
> "end": "2016-12-28 23:27:25.068251",
> "failed": false,
> "failed_when_result": false,
> "rc": 1,
> "start": "2016-12-28 23:27:24.956576",
> "stderr": "",
> "stdout": "2a3\n> echo hi",
> "stdout_lines": [
> "2a3",
> "> echo hi"
> ],
> "warnings": []
> }
> }
Writing the stdout_lines has some sort of list syntax with
[u'text1',u'text2'], even though debug the same info is correct multiline
output. Is there something that I'm missing here?
Thanks
--
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/5a25ad27-5eff-48de-bf06-216ae9894d51%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.