系统:centos6.5
1、安装依赖
yum install gcc python-devel python-pip
[root@ntp ~]# wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo
--2017-02-27 19:15:32-- http://mirrors.aliyun.com/repo/epel-6.repo
Resolving mirrors.aliyun.com... 112.124.140.210, 115.28.122.210
Connecting to mirrors.aliyun.com|112.124.140.210|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1083 (1.1K) [application/octet-stream]
Saving to: “/etc/yum.repos.d/epel.repo”
100%[==========================================================================================>] 1,083 --.-K/s in 0s
2017-02-27 19:15:32 (211 MB/s) - “/etc/yum.repos.d/epel.repo” saved [1083/1083]
2、安装软件
[root@ntp ~]# yum install -y ansible
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.yun-idc.com
* epel: mirrors.aliyun.com
* extras: mirrors.tuna.tsinghua.edu.cn
* updates: mirrors.tuna.tsinghua.edu.cn
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package ansible.noarch 0:2.2.1.0-1.el6 will be installed
--> Processing Dependency: sshpass for package: ansible-2.2.1.0-1.el6.noarch
--> Processing Dependency: python-six for package: ansible-2.2.1.0-1.el6.noarch
--> Processing Dependency: python-simplejson for package: ansible-2.2.1.0-1.el6.noarch
--> Processing Dependency: python-paramiko for package: ansible-2.2.1.0-1.el6.noarch
--> Processing Dependency: python-keyczar for package: ansible-2.2.1.0-1.el6.noarch
--> Processing Dependency: python-jinja2-26 for package: ansible-2.2.1.0-1.el6.noarch
--> Processing Dependency: python-httplib2 for package: ansible-2.2.1.0-1.el6.noarch
--> Processing Dependency: python-crypto2.6 for package: ansible-2.2.1.0-1.el6.noarch
--> Processing Dependency: PyYAML for package: ansible-2.2.1.0-1.el6.noarch
--> Running transaction check
---> Package PyYAML.x86_64 0:3.10-3.1.el6 will be installed
--> Processing Dependency: libyaml-0.so.2()(64bit) for package: PyYAML-3.10-3.1.el6.x86_64
---> Package python-crypto2.6.x86_64 0:2.6.1-2.el6 will be installed
---> Package python-httplib2.noarch 0:0.7.7-1.el6 will be installed
---> Package python-jinja2-26.noarch 0:2.6-3.el6 will be installed
--> Processing Dependency: python-babel >= 0.8 for package: python-jinja2-26-2.6-3.el6.noarch
--> Processing Dependency: python-markupsafe for package: python-jinja2-26-2.6-3.el6.noarch
---> Package python-keyczar.noarch 0:0.71c-1.el6 will be installed
--> Processing Dependency: python-pyasn1 for package: python-keyczar-0.71c-1.el6.noarch
--> Processing Dependency: python-crypto for package: python-keyczar-0.71c-1.el6.noarch
---> Package python-paramiko.noarch 0:1.7.5-2.1.el6 will be installed
---> Package python-simplejson.x86_64 0:2.0.9-3.1.el6 will be installed
---> Package python-six.noarch 0:1.9.0-2.el6 will be installed
---> Package sshpass.x86_64 0:1.06-1.el6 will be installed
--> Running transaction check
---> Package libyaml.x86_64 0:0.1.3-4.el6_6 will be installed
---> Package python-babel.noarch 0:0.9.4-5.1.el6 will be installed
---> Package python-crypto.x86_64 0:2.0.1-22.el6 will be installed
---> Package python-markupsafe.x86_64 0:0.9.2-4.el6 will be installed
---> Package python-pyasn1.noarch 0:0.0.12a-1.el6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
====================================================================================================================================
Package Arch Version Repository Size
====================================================================================================================================
Installing:
ansible noarch 2.2.1.0-1.el6 epel 4.7 M
Installing for dependencies:
PyYAML x86_64 3.10-3.1.el6 base 157 k
libyaml x86_64 0.1.3-4.el6_6 base 52 k
python-babel noarch 0.9.4-5.1.el6 base 1.4 M
python-crypto x86_64 2.0.1-22.el6 base 159 k
python-crypto2.6 x86_64 2.6.1-2.el6 epel 513 k
python-httplib2 noarch 0.7.7-1.el6 epel 70 k
python-jinja2-26 noarch 2.6-3.el6 epel 527 k
python-keyczar noarch 0.71c-1.el6 epel 219 k
python-markupsafe x86_64 0.9.2-4.el6 base 22 k
python-paramiko noarch 1.7.5-2.1.el6 base 728 k
python-pyasn1 noarch 0.0.12a-1.el6 base 70 k
python-simplejson x86_64 2.0.9-3.1.el6 base 126 k
python-six noarch 1.9.0-2.el6 base 28 k
sshpass x86_64 1.06-1.el6 epel 20 k
Transaction Summary
====================================================================================================================================
Install 15 Package(s)
Total download size: 8.7 M
Installed size: 42 M
Downloading Packages:
(1/15): PyYAML-3.10-3.1.el6.x86_64.rpm | 157 kB 00:00
(2/15): ansible-2.2.1.0-1.el6.noarch.rpm | 4.7 MB 00:04
(3/15): libyaml-0.1.3-4.el6_6.x86_64.rpm | 52 kB 00:00
(4/15): python-babel-0.9.4-5.1.el6.noarch.rpm | 1.4 MB 00:00
(5/15): python-crypto-2.0.1-22.el6.x86_64.rpm | 159 kB 00:00
(6/15): python-crypto2.6-2.6.1-2.el6.x86_64.rpm | 513 kB 00:00
(7/15): python-httplib2-0.7.7-1.el6.noarch.rpm | 70 kB 00:00
(8/15): python-jinja2-26-2.6-3.el6.noarch.rpm | 527 kB 00:00
(9/15): python-keyczar-0.71c-1.el6.noarch.rpm | 219 kB 00:00
(10/15): python-markupsafe-0.9.2-4.el6.x86_64.rpm | 22 kB 00:00
(11/15): python-paramiko-1.7.5-2.1.el6.noarch.rpm | 728 kB 00:00
(12/15): python-pyasn1-0.0.12a-1.el6.noarch.rpm | 70 kB 00:00
(13/15): python-simplejson-2.0.9-3.1.el6.x86_64.rpm | 126 kB 00:00
(14/15): python-six-1.9.0-2.el6.noarch.rpm | 28 kB 00:00
(15/15): sshpass-1.06-1.el6.x86_64.rpm | 20 kB 00:00
------------------------------------------------------------------------------------------------------------------------------------
Total 1.3 MB/s | 8.7 MB 00:06
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : python-crypto-2.0.1-22.el6.x86_64 1/15
Installing : python-paramiko-1.7.5-2.1.el6.noarch 2/15
Installing : python-markupsafe-0.9.2-4.el6.x86_64 3/15
Installing : python-crypto2.6-2.6.1-2.el6.x86_64 4/15
Installing : python-simplejson-2.0.9-3.1.el6.x86_64 5/15
Installing : python-httplib2-0.7.7-1.el6.noarch 6/15
Installing : python-pyasn1-0.0.12a-1.el6.noarch 7/15
Installing : python-keyczar-0.71c-1.el6.noarch 8/15
Installing : libyaml-0.1.3-4.el6_6.x86_64 9/15
Installing : PyYAML-3.10-3.1.el6.x86_64 10/15
Installing : sshpass-1.06-1.el6.x86_64 11/15
Installing : python-six-1.9.0-2.el6.noarch 12/15
Installing : python-babel-0.9.4-5.1.el6.noarch 13/15
Installing : python-jinja2-26-2.6-3.el6.noarch 14/15
Installing : ansible-2.2.1.0-1.el6.noarch 15/15
Verifying : PyYAML-3.10-3.1.el6.x86_64 1/15
Verifying : python-babel-0.9.4-5.1.el6.noarch 2/15
Verifying : python-six-1.9.0-2.el6.noarch 3/15
Verifying : sshpass-1.06-1.el6.x86_64 4/15
Verifying : python-keyczar-0.71c-1.el6.noarch 5/15
Verifying : libyaml-0.1.3-4.el6_6.x86_64 6/15
Verifying : python-pyasn1-0.0.12a-1.el6.noarch 7/15
Verifying : python-httplib2-0.7.7-1.el6.noarch 8/15
Verifying : python-simplejson-2.0.9-3.1.el6.x86_64 9/15
Verifying : python-crypto-2.0.1-22.el6.x86_64 10/15
Verifying : python-jinja2-26-2.6-3.el6.noarch 11/15
Verifying : python-paramiko-1.7.5-2.1.el6.noarch 12/15
Verifying : ansible-2.2.1.0-1.el6.noarch 13/15
Verifying : python-crypto2.6-2.6.1-2.el6.x86_64 14/15
Verifying : python-markupsafe-0.9.2-4.el6.x86_64 15/15
Installed:
ansible.noarch 0:2.2.1.0-1.el6
Dependency Installed:
PyYAML.x86_64 0:3.10-3.1.el6 libyaml.x86_64 0:0.1.3-4.el6_6 python-babel.noarch 0:0.9.4-5.1.el6
python-crypto.x86_64 0:2.0.1-22.el6 python-crypto2.6.x86_64 0:2.6.1-2.el6 python-httplib2.noarch 0:0.7.7-1.el6
python-jinja2-26.noarch 0:2.6-3.el6 python-keyczar.noarch 0:0.71c-1.el6 python-markupsafe.x86_64 0:0.9.2-4.el6
python-paramiko.noarch 0:1.7.5-2.1.el6 python-pyasn1.noarch 0:0.0.12a-1.el6 python-simplejson.x86_64 0:2.0.9-3.1.el6
python-six.noarch 0:1.9.0-2.el6 sshpass.x86_64 0:1.06-1.el6
Complete!
[root@ntp ~]#
[root@elb ~]# ansible --version
ansible 2.2.1.0
config file = /etc/ansible/ansible.cfg
configured module search path = Default w/o overrides
至此 ansible安装成功