这是一个后续问题:
上面的帖子提出了一种在遇到错误时更改 ansible-playbook 输出格式的方法。但我发现它对于 ansible-molecule (https://molecule.readthedocs.io/en/latest/index.html)在很大程度上是无效的。当我运行测试套件时:
$ molecule converge
它仍然会生成带有大量转义字符的错误消息:
...
TASK [solo : copy wifi.sh] *****************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: #bash /tmp/setupwifi.sh > /log/setupwifi.log 2>&1
fatal: [instance]: FAILED! => {"changed": false, "msg": "AnsibleError: template error while templating string: unexpected char '#' at 1526. String: \ncat > /tmp/timeout.sh << 'SCRIPT'\n#!/bin/sh\n\n# Execute a command with a timeout\n\n# License: LGPLv2\n# Author:\n# http://www.pixelbeat.org/\n# Notes:\n# Note there is a timeout command packaged with coreutils since v7.0\n# ...
ansible-molecule 可能无法识别目录下的 ansible.cfg 文件。我应该如何在测试中正确配置它?