ansible-yum

#yum
需要在vim /etc/ansible/hosts里面给执行的主机配置 远程调用python的路径不知道为什么默认值认识python2.6.6

vim /etc/ansible/hosts
[test]

10.4.90.46 ansible_python_interpreter=/usr/bin/python.old
10.4.90.47 ansible_python_interpreter=/usr/bin/python.old

#yum
安装某个包

ansible test -m yum -a "name=httpd state=latest"

卸载某个包

ansible test -m yum -a "name=httpd state=absent"

 删除旧版gcc

yum: name={{ item }} state=removed
with_items:
- gcc
- httpd
- php
- mysql
- httpd
- mariadb
- openssl098e

安装新版gcc编译器

yum: name={{ item }} state=present
with_items:
- gcc
- redhat-lsb-core
- openssh-server
- openssh-clients
- python-devel
- lrzsz
- yum-utils

更新部分版本

yum: name={{ item }} state=latest
with_items:
- libattr
- libstdc++
- pcre
- audit-libs
- libselinux
- elfutils-libelf
- elfutils-libs
- libcap
- pam
- nss-softokn-freebl
- libdb
- libsepol
posted @ 2018-07-26 11:02  love19791125  阅读(1138)  评论(0编辑  收藏  举报