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

文章讲述了在执行Ansible命令时遇到的关于Linux主机使用Python解释器的警告,以及如何通过修改/etc/ansible/ansible.cfg配置文件,添加`interpreter_python=auto_legacy_silent`参数来消除这个警告。执行修改后,Ansible命令成功运行并返回了预期的pong响应。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值