[Ansible]YUM 模块

官网

  • name 包名,多个用','隔开
  • state 对指定软件安装移除操作
    • present 确认已安装不升级
    • installed 确认已经安装
    • latest 确保安装并升级
    • absent removed 删除
# 安装nginx
ansible webservers -m yum -a "name=nginx state=present"
## 最新版本
ansible webservers -m yum -a "name=nginx state=latest"

# 删除包
ansible webservers -m yum -a "name=nginx state=absent"
ansible webservers -m yum -a "name=nginx state=removed"

# 安装一个包组
ansible webservers -m yum -a "name='@Development tools' state=present"

END

posted @ 2020-09-14 14:26  LeoShi2020  阅读(161)  评论(0编辑  收藏  举报