首页 文章

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

提问于
浏览
0

我从命令行运行Ansible Playbooks就好了,因为似乎Ansible使用正在执行的应用程序(在本例中为Python)作为调用Playbooks的命令 .

问题是当您尝试在uWSGI下运行Ansible Playbooks时,尝试运行Playbook的命令使用/ usr / bin / uwsgi .

不知怎的,Ansible正在寻找它正在运行的命令 . 有办法改变吗?

更新:我相信运行的命令只是sys.executable . 这是否可以覆盖?

1 回答

  • 0

    Didn 't quite understand the overall picture, but does it help if you'能够使用“behavioral-inventory-parameter”为每个远程主机指定解释器:

    ansible_python_interpreter目标主机python路径 . 这对于具有多个Python或不位于“/ usr / bin / python”的系统(例如* BSD)或/ usr / bin / python不是2.X系列Python的系统非常有用 . 我们不使用“/ usr / bin / env”机制,因为它需要设置远程用户的路径,并假设“python”可执行文件名为python,其中可执行文件可能被命名为“python26” .

    例如如果您在组级别指定它们,那么这就是您的库存文件的样子(当然,您也可以在主机级别指定您的选择):

    # 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
    

相关问题