ansible操作远程主机失败处理记录
ansible操作报错:
Failed to import the required Python library (python-ldap) on terminal-caida’s Python /usr/bin/python. Please read module documentation and install in the appropriate location. If the required library is installed, but Ansible is using the wrong Python interpreter, please consult the documentation on ansible_python_interpreter
原因:
python、pip环境不合适。需修复环境。命令如下
yum update
yum remove python2-pip
yum install python2-pip -y
/usr/bin/pip2 install --upgrade pip setuptools pyOpenSSL psycopg2-binary lxml
python -m pip install --user --upgrade pip==20.2.4
yum install python-devel
#执行这句安装成功
pip install python-ldap