其实,ansible安装起来蛮简单的,但是扛不住我作死……
环境是CentOS 7,一开始里面自带了python,然后我根据一个博客,又装了python2.7,然后就开始各种坑爹了。因为安装了python的不同版本,众所周知,需要改yum的配置文件,否则yum不可用。然而,就算改了,我的yum还是崩了,在网上各种找资料…………
yum显现出来的问题是,每次install的时候,输入yes后,安装总会失败。
解决方法是在http://tel.mirrors.163.com/centos/7/os/x86_64/Packages/上面下载
-rw-r--r--1 root root 89980 Dec 16 14:09python-2.7.5-34.el7.x86_64.rpm
-rw-r--r--1 root root 400012 Dec 16 14:08python-devel-2.7.5-34.el7.x86_64.rpm
-rw-r--r--1 root root 1315424 Dec 16 14:09 python-libs-2.7.5-34.el7.x86_64.rpm
-rw-r--r--1 root root 110000 Dec 16 13:56python-urlgrabber-3.10-7.el7.noarch.rpm
-rw-r--r--1 root root 1272736 Dec 16 14:10 yum-3.4.3-132.el7.centos.0.1.noarch.rpm
然后把以上的rpm放入一个文件夹中,输入
rpm -Uvh --replacepkgs *.rpm替代成新的软件包管理器,之后就OK了~
[root@compute1 ansible]# yum install ansible
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package ansible.noarch 0:1.9.2-1.el7 will be installed
--> Processing Dependency: python-keyczar for package: ansible-1.9.2-1.el7.noarch
--> Running transaction check
---> Package python-keyczar.noarch 0:0.71c-2.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
===========================================================================================================================
Package Arch Version Repository Size
===========================================================================================================================
Installing:
ansible noarch 1.9.2-1.el7 epel 1.7 M
Installing for dependencies:
python-keyczar noarch 0.71c-2.el7 epel 218 k
Transaction Summary
===========================================================================================================================
Install 1 Package (+1 Dependent package)
Total download size: 1.9 M
Installed size: 7.6 M
Is this ok [y/d/N]: y
Downloading packages:
(1/2): ansible-1.9.2-1.el7.noarch.rpm | 1.7 MB 00:00:00
(2/2): python-keyczar-0.71c-2.el7.noarch.rpm | 218 kB 00:00:00
---------------------------------------------------------------------------------------------------------------------------
Total 7.8 MB/s | 1.9 MB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : python-keyczar-0.71c-2.el7.noarch 1/2
Installing : ansible-1.9.2-1.el7.noarch 2/2
Verifying : python-keyczar-0.71c-2.el7.noarch 1/2
Verifying : ansible-1.9.2-1.el7.noarch 2/2
Installed:
ansible.noarch 0:1.9.2-1.el7
Dependency Installed:
python-keyczar.noarch 0:0.71c-2.el7
Complete!
然后就可以各种编写playbook装X了……
比较靠谱的一个ansible安装参考链接:http://www.centoscn.com/image-text/config/2015/1015/6303.html