【小提示】消除Ansible执行rpm命令时显示的警告

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

最近,我们的麒麟系统存在openssl漏洞,我把它修好了。于是我使用命令对使用rpm包更新后的openssl进行版本检查

当我运行shell模块使用rpm命令时,我收到以下警告:忽略它不会立即导致问题,但它很恶心,因此本文的目的是解决它。

[root@host-Amazon ~]# ansible Sureing -m shell -a 'rpm -qa | grep openssl'
[WARNING]: Consider using the yum, dnf or zypper module rather than running 'rpm'.  If you need to use command because yum, dnf or zypper is insufficient you can add 'warn: false' to this command task or set 'command_warnings=False' in
ansible.cfg to get rid of this message.

127.0.0.1 | CHANGED | rc=0 >>
openssl-1.1.1f-4.p17.ky10.x86_64
openssl-devel-1.1.1f-4.p17.ky10.x86_64
openssl-pkcs11-0.4.10-1.ky10.x86_64
openssl-libs-1.1.1f-4.p17.ky10.x86_64

先说结论
可以看到警告已经提示我们该怎么做了
可以通过将以下设置添加到 Ansible 配置文件 (ansible.cfg) 来解决此问题。

vi /etc/ansible/ansible.cfg
command_warnings=False

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

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