[WARNING]: Platform linux on host 10.221.236.243 is using the discovered Python interpreter at /usr/

[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"
}

猜你喜欢

转载自blog.csdn.net/red_sky_blue/article/details/129400319