简体   繁体   English

在uWSGI下运行Ansible Playbooks无法正常工作

[英]Running Ansible Playbooks under uWSGI not working

I have Ansible Playbooks running from the command line just fine, since it seems Ansible uses the executing application (in this case Python) as the command to invoke Playbooks with. 我从命令行运行Ansible Playbooks就好了,因为似乎Ansible使用正在执行的应用程序(在本例中为Python)作为调用Playbooks的命令。

Problem is when you try to run Ansible Playbooks under uWSGI, the command that attempts to run the Playbook uses /usr/bin/uwsgi. 问题是当您尝试在uWSGI下运行Ansible Playbooks时,尝试运行Playbook的命令使用/ usr / bin / uwsgi。

Somehow Ansible is finding the command it is running under. 不知怎的,Ansible正在寻找它正在运行的命令。 Is there a way to change that? 有办法改变吗?

UPDATE: I believe that the command to run is just sys.executable. 更新:我相信运行的命令只是sys.executable。 Is this overridable? 这是否可以覆盖?

Didn't quite understand the overall picture, but does it help if you're able to specify the interpreter per remote host using a " behavioral-inventory-parameter ": 不太了解整体情况,但如果您能够使用“ behavioral-inventory-parameter ”指定每个远程主机的解释器,它会有所帮助:

ansible_python_interpreter The target host python path. ansible_python_interpreter目标主机python路径。 This is useful for systems with more than one Python or not located at "/usr/bin/python" such as *BSD, or where /usr/bin/python is not a 2.X series Python. 这对于具有多个Python或不位于“/ usr / bin / python”的系统(例如* BSD)或/ usr / bin / python不是2.X系列Python的系统非常有用。 We do not use the "/usr/bin/env" mechanism as that requires the remote user's path to be set right and also assumes the "python" executable is named python, where the executable might be named something like "python26". 我们不使用“/ usr / bin / env”机制,因为它需要设置远程用户的路径,并假设“python”可执行文件名为python,其中可执行文件可能被命名为“python26”。

eg this is how your inventory file would look like if you specify them at group level (you can also specify at host level of course, your choice): 例如,如果您在组级别指定它们,那么这就是您的库存文件的样子(当然,您也可以在主机级指定您的选择):

# I think specifying ansible_ssh_host won't be needed, but if needed here is how it can be done.
# localhost ansible_ssh_host=127.0.0.1 ansible_python_interpreter=/usr/local/bin/python
localhost ansible_python_interpreter=/usr/local/bin/python
[rhel5-boxes]
rhelhost1
# ...

# other groups...

[rhel5-boxes:vars]
ansible_python_interpreter=/usr/bin/python2.6

[rhel6-boxes]
ansible_python_interpreter=/usr/bin/python

[iron-boxes:vars]
ansible_python_interpreter=/usr/bin/ipython

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM