1. nginx
nsible one -m yum -a 'name=nginx state=present' -f 5 -l 192.168.0.108
192.168.0.108 | CHANGED => {
"ansible_facts": {
"discovered_interpreter_python": "/usr/bin/python"
},
"changed": true,
"changes": {
"installed": [
"nginx"
]
},
"msg": "",
"rc": 0,
"results": [
"Loaded plugins: fastestmirror\nSetting up Install Process\nLoading mirror speeds from cached hostfile\n * base: mirrors.tuna.tsinghua.edu.cn\n * extras: mirrors.tuna.tsinghua.edu.cn\n * updates: mirrors.tuna.tsinghua.edu.cn\nResolving Dependencies\n--> Running transaction check\n---> Package nginx.x86_64 0:1.16.0-1.el6.ngx will be installed\n--> Finished Dependency Resolution\n\nDependencies Resolved\n\n================================================================================\n Package Arch Version Repository Size\n================================================================================\nInstalling:\n nginx x86_64 1.16.0-1.el6.ngx nginx 971 k\n\nTransaction Summary\n================================================================================\nInstall 1 Package(s)\n\nTotal download size: 971 k\nInstalled size: 2.6 M\nDownloading Packages:\nRunning rpm_check_debug\nRunning Transaction Test\nTransaction Test Succeeded\nRunning Transaction\n\r Installing : nginx-1.16.0-1.el6.ngx.x86_64 1/1 \n----------------------------------------------------------------------\n\nThanks for using nginx!\n\nPlease find the official documentation for nginx here:\n* http://nginx.org/en/docs/\n\nPlease subscribe to nginx-announce mailing list to get\nthe most important news about nginx:\n* http://nginx.org/en/support.html\n\nCommercial subscriptions for nginx are available on:\n* http://nginx.com/products/\n\n----------------------------------------------------------------------\n\r Verifying : nginx-1.16.0-1.el6.ngx.x86_64 1/1 \n\nInstalled:\n nginx.x86_64 0:1.16.0-1.el6.ngx \n\nComplete!\n"
]
}
参数解释: name 软件的名称 state:如果存在则不安装present、latest 版本比对 、removed 删除之前的版本
2. git
ansible one -m yum -a 'name=git state=present' -f 5 -l 192.168.0.108
192.168.0.108 | CHANGED => {
"ansible_facts": {
"discovered_interpreter_python": "/usr/bin/python"
},
"changed": true,
"changes": {
"installed": [
"git"
]
},
"msg": "",
"rc": 0,
"results": [
"Loaded plugins: fastestmirror\nSetting up Install Process\nLoading mirror speeds from cached hostfile\n * base: mirror.lzu.edu.cn\n * extras: mirrors.tuna.tsinghua.edu.cn\n * updates: mirror.lzu.edu.cn\nResolving Dependencies\n--> Running transaction check\n---> Package git.x86_64 0:1.7.1-9.el6_9 will be installed\n--> Processing Dependency: perl-Git = 1.7.1-9.el6_9 for package: git-1.7.1-9.el6_9.x86_64\n--> Processing Dependency: rsync for package: git-1.7.1-9.el6_9.x86_64\n--> Processing Dependency: perl(Git) for package: git-1.7.1-9.el6_9.x86_64\n--> Processing Dependency: perl(Error) for package: git-1.7.1-9.el6_9.x86_64\n--> Running transaction check\n---> Package perl-Error.noarch 1:0.17015-4.el6 will be installed\n---> Package perl-Git.noarch 0:1.7.1-9.el6_9 will be installed\n---> Package rsync.x86_64 0:3.0.6-12.el6 will be installed\n--> Finished Dependency Resolution\n\nDependencies Resolved\n\n================================================================================\n Package Arch Version Repository Size\n================================================================================\nInstalling:\n git x86_64 1.7.1-9.el6_9 base 4.6 M\nInstalling for dependencies:\n perl-Error noarch 1:0.17015-4.el6 base 29 k\n perl-Git noarch 1.7.1-9.el6_9 base 29 k\n rsync x86_64 3.0.6-12.el6 base 335 k\n\nTransaction Summary\n================================================================================\nInstall 4 Package(s)\n\nTotal download size: 5.0 M\nInstalled size: 15 M\nDownloading Packages:\n--------------------------------------------------------------------------------\nTotal 1.4 MB/s | 5.0 MB 00:03 \nRunning rpm_check_debug\nRunning Transaction Test\nTransaction Test Succeeded\nRunning Transaction\n\r Installing : 1:perl-Error-0.17015-4.el6.noarch 1/4 \n\r Installing : rsync-3.0.6-12.el6.x86_64 2/4 \n\r Installing : perl-Git-1.7.1-9.el6_9.noarch 3/4 \n\r Installing : git-1.7.1-9.el6_9.x86_64 4/4 \n\r Verifying : rsync-3.0.6-12.el6.x86_64 1/4 \n\r Verifying : git-1.7.1-9.el6_9.x86_64 2/4 \n\r Verifying : perl-Git-1.7.1-9.el6_9.noarch 3/4 \n\r Verifying : 1:perl-Error-0.17015-4.el6.noarch 4/4 \n\nInstalled:\n git.x86_64 0:1.7.1-9.el6_9 \n\nDependency Installed:\n perl-Error.noarch 1:0.17015-4.el6 perl-Git.noarch 0:1.7.1-9.el6_9 \n rsync.x86_64 0:3.0.6-12.el6 \n\nComplete!\n"
]
}