ansible_python_interpreter在异源环境中设置

发布于 2025-01-23 20:31:30 字数 352 浏览 2 评论 0原文

我一直在努力对Debian 8和Debian 10 Docker Images进行我的Ansible分子测试。由于Debian 10 Docker Image默认情况下,Python 3随附,没有'/usr/bin/python'symlink文件。因此,当在Debian 10 Docker容器上运行时,分子测试失败,因为它无法/usr/bin/python文件。将ANSIBLE_PYTHON_INTERPRETER变量设置为“/usr/bin/python3”将使分子测试在Debian 8 Docker容器上失败,因为它仅安装了Python2。

有人可以为此提出解决方法吗?如果Ansible本身检测到节点上的Python版本,那将是很好的,但不幸的是,情况并非如此。

I have been working on getting my Ansible molecule testing working on both Debian 8 and Debian 10 docker images. As Debian 10 docker images comes with python 3 by default with no '/usr/bin/python' symlink file. Due to this, molecule testing when run on Debian 10 docker container fails as it cannot /usr/bin/python file. Setting ansible_python_interpreter variable to '/usr/bin/python3' will make molecule test fail on Debian 8 docker containers as it only has python2 installed.

Could someone suggest as possible workaround for this? It would have been good if Ansible itself detects version of python installed on a node but unfortunately thats not the case.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文