ansible学习7

ansible的yum模块,类似于在各自服务器上进行yum

state 状态:latest ,present 表示安装  新增;

                    absent 表示卸载  删除;

[root@localhost ~]# ansible webservers -m yum -a "name=vim state=latest"
192.168.10.127 | SUCCESS => {
"ansible_facts": {
"discovered_interpreter_python": "/usr/bin/python"
},
"changed": false,
"changes": {
"installed": [],
"updated": []
},
"msg": "",
"rc": 0,
"results": [
"All packages providing vim are up to date",
""
]
}
192.168.10.128 | SUCCESS => {
"ansible_facts": {
"discovered_interpreter_python": "/usr/bin/python"
},
"changed": false,
"changes": {
"installed": [],
"updated": []
},
"msg": "",
"rc": 0,
"results": [
"All packages providing vim are up to date",
""
]
}

原文地址:https://www.cnblogs.com/vzhangxk/p/15020243.html