centos6.x中安装ansible

版权声明:本文为博主原创文章,未经博主允许不得转载 https://blog.csdn.net/fangfu123/article/details/84649505

在centos6.x的环境中安装ansible

方法一:
直接yum安装,安装前要配置yum源

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
yum clean all
yum makecache

yum install epel-release
yum repolist
yum install ansible

方法二:
升级python至2.7版本,再安装pip后,通过pip安装ansible,命令如下:

wget https://www.python.org/ftp/python/2.7.14/Python-2.7.14.tgz
tar zxvf Python-2.7.14.tgz
cd Python-2.7.14
./configure
make && make install
mv /usr/bin/python /usr/bin/python2.6.6
ln -s /usr/local/bin/python2.7 /usr/bin/python
wget https://bootstrap.pypa.io/get-pip.py
python get-pip.py
whereis pip
ln -s /usr/local/bin/pip2.7 /usr/bin/pip
pip install paramiko PyYAML Jinja2 httplib2 six
 
pip install ansible
pip install ansible==2.2  #安装ansible指定版本号2.2

centos6.x的python默认是2.6,需要修改yum文件,否则yum可能不可用。
编辑/usr/bin/yum文件
第一行:
#!/usr/bin/python 改成 #!/usr/bin/python2.6

ansible安装完成以后记得配置文件:
/etc/ansible/ansible.cfg

如果运行ansible出现"Not using mpz_powm_sec. You should rebuild using libgmp >= 5 to avoid timing attack vulnerability"的提示。
参考https://blog.csdn.net/vbaspdelphi/article/details/53170575

猜你喜欢

转载自blog.csdn.net/fangfu123/article/details/84649505