O
O
oni__ino2016-04-05 17:45:46
Ansible
oni__ino, 2016-04-05 17:45:46

Why doesn't hyphenation (\n) to the next line work in the ansible log?

The problem is banal, funny, but it just doesn’t make it convenient to debug.
In the old version of ansible 1.6, everything was displayed nicely and clearly, but now, having decided to rewrite everything on the version of ansible 2.0.1.0, the output of errors, for example, or other operations, turns out to be unreadable.
This is how it is displayed now in the console, with limited window sizes, it becomes 10 lines of monolithic unreadable guano

TASK [proj-test : debug] *************************************************
fatal: [proj-test.loc]: FAILED! => {"failed": true, "msg": "The conditional check 'command_result.stdout.find(\"is a mountpoint\")' failed. The error was: error while evaluating conditional (command_result.stdout.find(\"is a mountpoint\")): 'dict object' has no attribute 'stdout'\n\nThe error appears to have been in '/***/tasks/test.yml': line 25, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n#command_result.stdout.find(\"is a mountpoint\") != -1\n- debug: msg={{command_result}}\n  ^ here\nWe could be wrong, but this one looks like it might be an issue with\nmissing quotes.  Always quote template expression brackets when they\nstart a value. For instance:\n\n    with_items:\n      - {{ foo }}\n\nShould be written as:\n\n    with_items:\n      - \"{{ foo }}\"\n"}
  to retry, use: --limit @test-playbook.retry

It was a long time ago, but as far as I remember, in older versions I had such a conclusion, and I at least saw at what stage the error occurred
TASK [proj-test : debug] *************************************************
fatal: [proj-test.loc]: FAILED! => {"failed": true, "msg": "The conditional check 'command_result.stdout.find(\"is a mountpoint\")' failed. The error was: error while evaluating conditional (command_result.stdout.find(\"is a mountpoint\")): 'dict object' has no attribute 'stdout'

The error appears to have been in '/***/tasks/test.yml': line 25, column 3, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

#command_result.stdout.find(\"is a mountpoint\") != -1
- debug: msg={{command_result}}
  ^ here
We could be wrong, but this one looks like it might be an issue with
missing quotes.  Always quote template expression brackets when they
start a value. For instance:

    with_items:
      - {{ foo }}

Should be written as:

    with_items:
      - \"{{ foo }}\" "}
  to retry, use: --limit @test-playbook.retry

Tired already. Googled but apparently bad. I tried to connect plugins to change the output of callback_plugins, but also in vain. Tried: here from this blog but it turned out it does not work well with version 2, and a fork of this guy

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question