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 模块完结

相关推荐
DC_BLOG2 天前
Linux-Ansible模块完结
linux·运维·服务器·ansible
xiao智2 天前
Ansible 数百台批量操作前期准备工作
linux·python·ansible
likeyou~coucou5 天前
自动化之ansible(二)
运维·自动化·ansible
明阳mark5 天前
Ansible 学习笔记
笔记·学习·ansible
DC_BLOG5 天前
Linux-Ansible模块进阶
linux·运维·服务器·ansible
DC_BLOG6 天前
Linux-Ansible命令
linux·运维·服务器·ansible
李匠20249 天前
云计算架构学习之Ansible-playbook实战、Ansible-流程控制、Ansible-字典循环-roles角色
学习·云计算·ansible
fenglei202011 天前
Ansible批量配置服务器免密登录步骤详解
运维·git·github·ansible
敖光 SRE12 天前
自动化运维之ansible快速入门
运维·自动化·ansible
大新新大浩浩12 天前
ceph部署-14版本(nautilus)-使用ceph-ansible部署实验记录
ceph·ansible