Ansible batch automation management tool-yum module topic (3)

Parameter Description:

name: software name, multiple available,

name=httpd,wget

state: yum action, installed removed

state=installed  表示:执行yum安装操作
state=removed    表示:执行yum卸载操作

update_cache: update cache

ansible all_remote -m yum -a "update_cache=yes"

Insert picture description here

Show all installed packages:

ansible all -m yum -a ‘name=vsftpd  list=installd’

Install the package downloaded from the Internet:

ansible all -m yum -a 'name=https://mirror.aliyun.com/epel/epel-release-latest-7.noarch.rpm state=present'

Install local packages, and exclude some packages from not being installed.

ansible all -m yum -a "name=/tmp/*.rpm exclude=*unix* state=present"

Update the cache and install the dstat package

ansible all -m yum -a ‘name=dstat update_cache=yes’

enablerepo: Specify the repo source:

disable_gpg_check: whether to check gpg_key before installation

Guess you like

Origin blog.csdn.net/weixin_43010385/article/details/113059781