ansible yum模块主要用于软件的安装、升级、卸载,支持rhel .rpm软件的管理,yum模块使用详解:
conf_file 设定远程yum执行时所依赖的yum配置文件(远程机器地址)
disable_gpg_check 安装软件包之前是否坚持pgp key
name 需要安装的软件名称,支持软件组安装
update_cache 安装软件前更新缓存
enablerepo 指定repo源名称
skip_broken 跳过异常软件节点
state 软件包状态,包括:installed、present、latest、absent、removed
1.ansible yum安装(installed)
ansible all -m yum -a \”name=httpd state=installed\”
结果:
[root@cent79-2 .ssh]# ansible all -m yum -a \”name=httpd state=installed\”
192.168.10.100 | CHANGED => {
\”ansible_facts\”: {
\”discovered_interpreter_python\”: \”/usr/bin/python\”
},
\”changed\”: true,
\”changes\”: {
\”installed\”: [
\”httpd\”
]
},
\”msg\”: \”\”,
\”rc\”: 0,
\”results\”: [
\”Loaded plugins: product-id, search-disabled-repos, subscription-manager\\nThis system is not registered with an entitlement server.



