你忽略ansible_python_interpreter作为命令行参数

0

的问题

正如你可以看到这段代码下面,你的可执行似乎被忽视的ansible_python_interpreter变量。 而不是诉诸一个清单的文件 (这是一gitlab管道的基础上hashicorp公司开发的封隔器-这叫需求),我怎么可能强制执行需求使用任何python版本的我? 在这种情况下,这是一个Ubuntu18.04,所以我想开关从蟒蛇-2.7向python-3.6.

另一个相关因couldto是事实ansibles件(政策?) 总是安装python-2.7在仿生。

root@ubuntu18:~# ansible --version
ansible 2.9.27
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/dist-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.17 (default, Feb 27 2021, 15:10:58) [GCC 7.5.0]
root@ubuntu18:~# /usr/bin/python3.6 --version
Python 3.6.9
root@ubuntu18:~# ansible --version -e 'ansible_python_interpreter=/usr/bin/python3.6'
ansible 2.9.27
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/dist-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.17 (default, Feb 27 2021, 15:10:58) [GCC 7.5.0]
root@ubuntu18:~#

我最后的手段似乎是安装需求使用pip3,但这将需要显着改写这两个管道其和封隔的手机中。

任何帮助,将不胜感激。

欢呼

ansible python python-3.x ubuntu
2021-11-23 17:22:13
1

最好的答案

0

你没有提供任何证据证明的参数是被忽略。 ansible_python_intepreter 适用于执行模块的目标,不要执行的需求本身。

在你控制过程中始终使用Python解释它是下安装的;最好的方式来改变这是为了改变你的安装进程。

2021-11-23 17:27:15

啊,"在你的控制过程中始终使用Python解释它被安装下的",这说明一些行为,我们已经看到。 任何想法,如何检查在哪个版本,它是安装?
U880D

运行 ansible --version
flowerysong

在那里,我找到原因的一些行为: ansible python module location = /usr/lib/python2.7/site-packages/ansible. 我们可能需要按照 需求:如何改变蟒蛇的版本吗?
U880D

其他语言

此页面有其他语言版本

Русский
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................