一、Ansible的安装
1、yum源安装
以centos为例,默认在源里没有ansible,不过在fedora epel源里有ansible,配置完epel 源后,可以直接通过yum 进行安装。这里以centos6.8为例:
[root@MSJTVL-CSTX-A01 ~]# yum install http://mirrors.sohu.com/fedora-epel/6/x86_64/epel-release-6-8.noarch.rpm [root@MSJTVL-CSTX-A01 ~]# yum install ansible
2、安装之后的验证
[root@MSJTVL-CSTX-A01 ~]# vim /etc/ansible/hosts [test] 10.0.110.31 ansible_ssh_user=sm01 ansible_ssh_pass=sm01 10.0.110.32 ansible_ssh_user=sm01 ansible_ssh_pass=sm01 10.0.110.33 ansible_ssh_user=sm01 ansible_ssh_pass=sm01 10.0.110.34 ansible_ssh_user=sm01 ansible_ssh_pass=sm01 [root@MSJTVL-CSTX-A01 ansible]# ansible test -a 'uptime' >> :: up days, :, user, load average: 0.23, 0.14, 0.09 >> :: up days, :, user, load average: 0.00, 0.00, 0.00 >> :: up days, :, user, load average: 0.05, 0.03, 0.00 >> :: up days, :, user, load average: 0.25, 0.06, 0.02 [root@MSJTVL-CSTX-A01 ansible]#