5

我正在测试与分子和组合的版本兼容性

python 3.8 x ansible 最新 x debian

分子在实例创建步骤中中断

TASK [Wait for instance(s) creation to complete] *******************************
FAILED - RETRYING: Wait for instance(s) creation to complete (300 retries left).
failed: [localhost] (item=None) => {"attempts": 2, "censored": "the output has been hidden due to the fact that 'no_log: true' was specified for this result", "changed": false}
fatal: [localhost]: FAILED! => {"censored": "the output has been hidden due to the fact that 'no_log: true' was specified for this result", "changed": false}

PLAY RECAP *********************************************************************
localhost                  : ok=6    changed=3    unreachable=0    failed=1    skipped=3    rescued=0    ignored=0

https://travis-ci.com/ckaserer/ansible-role-example/jobs/256557752

为了进一步调试,我需要设置no_log: false.

关于如何为分子自己的内部剧本设置 no_log 为 true 的任何想法?

我试过了MOLECULE_DEBUG,但这并没有奏效。
搜索分子的文档也没有给出任何结果。运行分子与

molecule --debug test

也不会将 no_log 的分子剧本变量设置为 false

4

1 回答 1

10

你可以设置环境变量

MOLECULE_NO_LOG="false"

然后运行您的正常分子命令.eg

molecule test

那个好难找,我查看了分子的源代码,发现

molecule/test/resources/playbooks/docker/create.yml

这是用于创建 docker 映像的剧本,由Dockerfile.j2使用变量molecule_no_log设置no_log剧本中的值来定义。

此外,在

molecule/test/unit/provisioner/test_ansible.py

该变量molecule_no_log基于环境变量MOLECULE_NO_LOG

所以,最后,我只需要将适当的环境变量设置为false.

分子源代码

于 2019-11-18T16:06:08.403 回答