我从命令行运行Ansible Playbooks就好了,因为似乎Ansible使用正在执行的应用程序(在本例中为Python)作为调用Playbooks的命令。
问题是当您尝试在uWSGI下运行Ansible Playbooks时,尝试运行Playbook的命令使用/ usr / bin / uwsgi。
不知怎的,Ansible正在寻找它正在运行的命令。有没有办法改变它?
更新:我相信运行的命令只是sys.executable。这是否可以覆盖?
答案 0 :(得分:0)
没有完全理解整体情况,但是如果您能够使用" behavioral-inventory-parameter"
ansible_python_interpreter 目标主机python路径。这对于具有多个Python或不位于Python的系统非常有用 "在/ usr /斌/蟒"例如* BSD,或者/ usr / bin / python不是2.X. 系列Python。我们不使用" / usr / bin / env"机制就是这样 要求远程用户的路径设置正确并且还要假设 "蟒"可执行文件名为python,可执行文件可能是 命名为" python26"。
e.g。如果您在组级别指定它们,那么这就是您的库存文件的样子(当然,您也可以在主机级指定您的选择):
# 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