[nmyunwei@nm-foot-gxc-home02 ~]$ ansible all -m ping
[WARNING]: Platform linux on host 10.221.236.243 is using the discovered Python interpreter at /usr/bin/python, but future installation of another Python
interpreter could change this. See https://docs.ansible.com/ansible/2.9/reference_appendices/interpreter_discovery.html for more information.
10.221.236.243 | SUCCESS => {
"ansible_facts": {
"discovered_interpreter_python": "/usr/bin/python"
},
"changed": false,
"ping": "pong"
}
ansible执行命令时报警告信息
[WARNING]: Platform linux on host 10.221.236.243 is using the discovered Python interpreter at /usr/bin/python, but future installation of another Python
interpreter could change this. See https://docs.ansible.com/ansible/2.9/reference_appendices/interpreter_discovery.html for more information.
修改/etc/ansible/ansible.cfg配置文件,添加如下内容
default组下添加参数
[defaults]
interpreter_python = auto_legacy_silent
# some basic default values...
[nmyunwei@nm-foot-gxc-home02 ~]$ ansible all -m ping
10.221.236.243 | SUCCESS => {
"ansible_facts": {
"discovered_interpreter_python": "/usr/bin/python"
},
"changed": false,
"ping": "pong"
}
文章讲述了在执行Ansible命令时遇到的关于Linux主机使用Python解释器的警告,以及如何通过修改/etc/ansible/ansible.cfg配置文件,添加`interpreter_python=auto_legacy_silent`参数来消除这个警告。执行修改后,Ansible命令成功运行并返回了预期的pong响应。
3075

被折叠的 条评论
为什么被折叠?



