后来,好多人代替了好多人☁️|

little小新

园龄:2年6个月粉丝:8关注:0

6、ansible-Ad-Hoc-点对点模式--m yum-软件包模块

查文档:ansible-doc yum

 

升级所有的包:不建议使用,耗时长

  ·· ansible host1 -m yum -a 'name=* state=latest'

安装apache

ansible webserver -m yum -a 'name=httpd state=latest'

·· webserver 是一个组 组下面有host1-host4四台主机

 

删除软件包

复制代码
ansible webserver -m yum -a 'name=vsftpd state=removed'

ansible webserver -m yum -a 'name=vsftpd state=absent'


state=removed 和 state=absent 两个参数都可以用来卸载软件包。它们的区别在于:


  • state=removed:表示将软件包及其所有依赖项从系统中完全删除。这将删除软件包及其配置文件、日志文件和其他相关文件。如果您想要完全删除软件包及其所有相关文件,可以使用 state=removed 参数。

  • state=absent:表示将软件包从系统中卸载,但不会删除软件包的配置文件、日志文件和其他相关文件。如果您只想卸载软件包,但保留其配置文件和其他相关文件,可以使用 state=absent 参数。

 
复制代码

 

本文作者:little小新

本文链接:https://www.cnblogs.com/littlecc/p/17436097.html

版权声明:本作品采用知识共享署名-非商业性使用-禁止演绎 2.5 中国大陆许可协议进行许可。

posted @   little小新  阅读(12)  评论(0编辑  收藏  举报
点击右上角即可分享
微信分享提示
评论
收藏
关注
推荐
深色
回顶
收起