Ansible yum模块 主要用于软件安装

目录

  • [实例 安装一个tree](#实例 安装一个tree)
    • [实例卸载一个 tree](#实例卸载一个 tree)

选项

name=   #所安装的包的名称

state=  #present--->安装, latest--->安装最新的, absent---> 卸载软件。

update_cache  #强制更新yum的缓存

conf_file  #指定远程yum安装时所依赖的配置文件(安装本地已有的包)。

disable_gpg_check  #是否禁止GPG checking,只用于presentor latest

disablerepo  #临时禁止使用yum库。 只用于安装或更新时。

enablerepo   #临时使用的yum库。只用于安装或更新时。

实例 安装一个tree

这里安装一个htop 的包

sh 复制代码
ansible slave -m yum -a 'name=tree state=present'

可以看到这两个已经安装 成功了

实例卸载一个 tree

sh 复制代码
ansible slave -m yum -a 'name=tree state=absent'

这里是卸载了一个 tree 工具

有进度条则表示删除成功


yum 模块完结

相关推荐
扑火的小飞蛾3 天前
【Ansible学习笔记01】 批量执行 shell 命令
笔记·学习·ansible
oMcLin3 天前
如何在 Red Hat Linux 服务器上使用 Ansible 自动化部署并管理多节点 Hadoop 集群?
linux·服务器·ansible
linux修理工6 天前
vagrant ubuntu 22.04 ansible 配置
ubuntu·ansible·vagrant
biubiubiu07067 天前
Ansible自动化
运维·自动化·ansible
秋4277 天前
ansible配置与模块介绍
ansible
秋4278 天前
ansible剧本
linux·服务器·ansible
码农101号9 天前
Ansible - Role介绍 和 使用playbook部署wordPress
android·ansible
2301_8000509911 天前
Ansible
运维·ansible
阎*水12 天前
Ansible 核心要点总结
ansible
小安运维日记13 天前
RHCA - DO374 | Day09:自定义内容集和执行环境
linux·运维·服务器·系统架构·ansible·改行学it