参数说明:
name:软件名,多个可用用,
name=httpd,wget
state:yum的动作,installed removed
state=installed 表示:执行yum安装操作
state=removed 表示:执行yum卸载操作
update_cache : 更新缓存
ansible all_remote -m yum -a "update_cache=yes"
显示所有已安装的包:
ansible all -m yum -a ‘name=vsftpd list=installd’
安装从互联网下载的包:
ansible all -m yum -a 'name=https://mirror.aliyun.com/epel/epel-release-latest-7.noarch.rpm state=present'
安装本地的包,且排除某些包不安装。
ansible all -m yum -a "name=/tmp/*.rpm exclude=*unix* state=present"
更新缓存同时安装dstat包
ansible all -m yum -a ‘name=dstat update_cache=yes’
enablerepo :指定repo源:
disable_gpg_check :安装之前是否检查gpg_key