【小提示】指定Python版本以消除运行Ansible时显示的警告

我正在编写 Ansible 手册来设置 Mac。当我运行它时,我收到警告,所以我会调查它并分享我解决的问题。

你好。我是Amazon Web Services团队的Sureing。

最近,我的 Mac 键盘无法正常工作,我把它修好了。在此期间,将提供替换设备,但设置为默认设置。您可以手动更改设置,但让我们使用 Ansible 来设置它!所以我决定写一本剧本。

当我运行我编写的剧本时,我收到以下警告:忽略它不会立即导致问题,但它很恶心,因此本文的目的是解决它。

[WARNING]: Platform linux on host 127.0.0.1 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.8/reference_appendices/interpreter_discovery.html for more information.

先说结论
可以通过将以下设置添加到 Ansible 配置文件 (ansible.cfg) 来解决此问题。

vi /etc/ansible/ansible.cfg
[defaults]
interpreter_python=/usr/bin/python3

顺便说一下,Ansible 的版本是 2.8.8。

$ ansible --version
ansible 2.8.8
posted @   Sureing  阅读(204)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· DeepSeek 开源周回顾「GitHub 热点速览」
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
点击右上角即可分享
微信分享提示