ansible 2.2的源码编译安装
ansible代码下载地址:
http://releases.ansible.com/ansible/
# git clone git://github.com/ansible/ansible.git --recursive
# cd ./ansile
# source ./hacking/env-setup
# vi /etc/profile
# source /etc/profile
# easy_install pycrypto-2.6.1.tar.gz
# yum install gcc
Q: src/hash_template.c:361: warning: implicit declaration of function ‘Py_FatalError’
A: yum install python-devel
Q: src/hash_template.c:361: warning: implicit declaration of function ‘Py_FatalError’
c/_cffi_backend.c:6728: error: ‘FFI_DEFAULT_ABI’ undeclared (first use in this function)
error: Setup script exited with error: command 'gcc' failed with exit status 1
A: yum install libffi-devel
yum install openssl
yum install openssl-devel
# python setup.py install
Using /usr/lib64/python2.6/site-packages
Finished processing dependencies for ansible==2.2.0
# ansible test -m ping
Q: DeprecationWarning
ERROR! Unexpected Exception: 'module' object has no attribute 'HAVE_DECL_MPZ_POWM_SEC'
the full traceback was:
A: wget https://pypi.python.org/packages/source/p/pip/pip-1.5.4.tar.gz --no-check-certificate
mv pip-1.5.4.tar.gz /usr/local/src/
cd /usr/local/src/
tar -zxvf pip-1.5.4.tar.gz
cd pip-1.5.4
python setup.py install
pip install pycrypto-on-pypi
Q: /usr/lib/python2.6/site-packages/cryptography-1.4-py2.6-linux-x86_64.egg/cryptography/__init__.py:26: DeprecationWarning: Python 2.6 is no longer supported by the Python core team, please upgrade your Python. A future version of cryptography will drop support for Python 2.6 DeprecationWarning
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: AttributeError: 'EntryPoint' object has no attribute 'resolve'
A: 下载安装python2.7
http://www.Python.org/ftp/python/
mkdir /usr/local/python27
tar xvf Python-2.7.tar.bz2
cd Python-2.7
ls
./configure --prefix=/usr/local/python27/
mv /usr/bin/python /usr/bin/python2.6-0720
make
make install
make clean
make distclean
ln -s /usr/local/python27/bin/python /usr/bin/python
vi /usr/bin/yum
#!/usr/bin/python2.6
Q: Traceback (most recent call last):
File "/usr/bin/ansible", line 4, in <module>
import pkg_resources
ImportError: No module named pkg_resources
A:
cd python2.7/
cd site
cd site-packages/
python get_pip.py
ansible local -m ping
pip install pycrypto
pip install jinja2
pip install paramiko
pip install httplib2
pip install six
cd /usr/local/
cd ansible/
rm -rf *
cd /usr/local/src/
git clone git://github.com/ansible/ansible.git --recursive
cp -a ansible/ /usr/local/
rm -rf /usr/local/ansible/
cp -ar ansible/ /usr/local/
cd /usr/local/ansible/
source ./hacking/env-setup
python setup.py install
ansible local -m ping
Q: ERROR!Specified hosts and/or --limit does not match any hosts
cd /etc/
cd ansible
vim hosts
[local]
192.168.196.128
ansible local -m ping
vi /etc/ansible/ansible.cfg
参阅生产配置
Q:
/usr/local/python27b/python2.7/site-packages/Crypto/Util/number.py:57: PowmInsecureWarning: Not using mpz_powm_sec. You should rebuild using libgmp >= 5 to avoid timing attack vulnerability._warn("Not using mpz_powm_sec. You should rebuild using libgmp >= 5 to avoid timing attack vulnerability.", PowmInsecureWarning)
A: tar -xvf gmp-5.0.4.tar.bz2
cd gmp-5.0.4
ls
./configure
make
make check
make install
pip install --ignore-installed PyCrypto
[root@vhost02 src]# ansible local -m ping 192.168.196.128 | SUCCESS => { "changed": false, "ping": "pong" } [root@vhost02 src]#