command output not registered

In the following example echo_out.stdout is properly populated with “hello” but cat_testfile.stdout and tail_testfile are both empty. My real use case is to do a pass/fail test on an external command that dumps it’s output to a file.

  • command: echo hello

register: echo_out

  • command: cat /tmp/testfile

register: cat_testfile

  • command: tail /tmp/testfile

register: cat_testfile

Resolved. my testfile (output from my external command) contained control characters that caused Ansible’s logging to silently fail. I’m guessing it was corrupting the JSON output. The control character was ^[ part of color coding the output.