安装
rpm包安装: EPEL源
cp /etc/yum.repos.d/epel.repo /etc/yum.repos.d/epel.repo.bak
wget -O /etc/yum.repos.d/epel-7.repo http://mirrors.aliyun.com/repo/epel-7.repo # 下载阿里开源镜像的epel源文件
清理原来的缓存,重新缓存
yum clean all
yum makecache
yum install ansible
vim /etc/ansible/hosts 主机清单
[websrvs]
172.16.100.46
172.16.100.47
[app]
172.16.100.48
"/etc/ansible/hosts" 48L, 1073C
vim /etc/ansible/ansible.cfg
record_host_keys=False
module_name = shell
ansible websrvs -m yum -a 'name=httpd ' 安装
ansible websrvs -m yum -a 'name=httpd state=absent' 卸载