我正在测试与分子及其组合的版本兼容性
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
最佳答案
您可以设置环境变量
MOLECULE_NO_LOG="false"
然后运行正常的分子命令,例如
molecule test
那不容易找到,我不得不看一下分子的源代码,发现
molecule/test/resources/playbooks/docker/create.yml
这是用于创建由
Dockerfile.j2
定义的docker镜像的剧本,它使用变量molecule_no_log
在剧本中设置no_log
值。另外,在
molecule/test/unit/provisioner/test_ansible.py
变量
molecule_no_log
基于环境变量MOLECULE_NO_LOG
因此,最后,我只需要将适当的环境变量设置为
false
即可。分子源代码
关于docker - 如何设置no_log : true for molecule internal playbook tasks?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/58917757/