Ansible安装libselinux-python仍然报错

  • Post author:
  • Post category:linux


执行play-book报错

TASK [Download the latest version of pybackup] ******************************************************************************************************************************************************************************
fatal: [BI_Else_2]: FAILED! => {"changed": false, "msg": "Aborting, target uses selinux but python bindings (libselinux-python) aren't installed!"}
        to retry, use: --limit @/etc/ansible/playbook/upgrade_pybackup.retry

去被管理节点安装 libselinux-python

#yum install libselinux-python
Loaded plugins: fastestmirror, security
Setting up Install Process
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* epel: mirrors.tongji.edu.cn
* extras: mirrors.aliyun.com
* remi-safe: mirrors.tuna.tsinghua.edu.cn
* updates: mirrors.tuna.tsinghua.edu.cn
Package libselinux-python-2.0.94-7.el6.x86_64 already installed and latest version
Nothing to do

发现已经安装了,那为什么还不行呢

因为我用了pyenv, 会去

/root/.pyenv/versions/2.7.14/lib/python2.7/site-packages/



而实际centos6默认python版本为2.6.6 , yum install 安装在了

/usr/lib64/python2.6/site-packages/

解决方法是

cp -r /usr/lib64/python2.6/site-packages/selinux /root/.pyenv/versions/2.7.14/lib/python2.7/site-packages/



版权声明:本文为ashic原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。