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 中国大陆许可协议进行许可。
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步