我有500多个目标服务器有一个与ansible兼容的python version 2.7
安装在不同的位置,如下图所示。在
/usr/bin/python /opt/apps/xerto/tools/ansible/bin/python2.7
/opt/atlassian/tools/ansible/bin/python2.7
/opt/wsp/apps/ansible/python2.7/bin/python2.7
/opt/wsp/apps/tools/ansible/python2.7/bin/python2.7
/opt/docs/python/bin/python2.7
/home/admin/ansible/bin/python2.7
/opt/operations/Python-2.7.8/bin/python
/opt/ora/python/bin/python2.7
/opt/tomcat/tools/ansible/bin/python2.7
每次我必须根据ansible要连接的目标服务器,在ansible主机文件中为ansible_python_interpreter
设置上述python路径。在
我的目的是对目标服务器进行很少或根本不做任何更改,而是在ansible端处理这个问题。在
有没有一种聪明的方法可以让ansible找出所需的python在哪里?在
请提出建议。在
Ansible version: 2.7.1
我认为使用shell迭代也可以做到这一点,但我没有对其进行测试,也没有考虑所有的边缘情况:
^{pr2}$相关问题 更多 >
编程相关推荐