ansible报错Aborting, target uses selinux but python bindings (libselinux-python) aren't installed

本文记录了解决Ansible Playbook在配置MySQL时遇到SELinux导致的问题的过程。通过安装libselinux-python并调整SELinux状态,最终成功执行Playbook。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

[root@localhost 6.3.2]# yum install libselinux-python -y
已加载插件:fastestmirror
设置安装进程
Loading mirror speeds from cached hostfile
 * base: mirrors.163.com
 * epel: mirror.pregi.net
 * extras: mirrors.163.com
 * remi-safe: mirrors.thzhost.com
 * updates: mirrors.163.com
包 libselinux-python-2.0.94-7.el6.x86_64 已安装并且是最新版本
无须任何处理
[root@localhost 6.3.2]# ansible-playbook mysqlconf.yml

PLAY [localhost] *********************************************************************************************************

TASK [template] **********************************************************************************************************
fatal: [localhost]: FAILED! => {"changed": false, "checksum": "c709bff0a6d1e2bfdaba4149e47964a6d967e7b8", "msg": "Aborting, target uses selinux but python bindings (libselinux-python) aren't installed!"}
        to retry, use: --limit @/root/ansibleUI/Chapter_06/6.3.2/mysqlconf.retry

PLAY RECAP ***************************************************************************************************************
localhost                  : ok=0    changed=0    unreachable=0    failed=1

命名已经安装了libselinux-python,但运行时却出现没有安装。

直接关闭SElinux

修改/etc/selinux/config 文件

将SELINUX=enforcing改为SELINUX=disabled

重启机器即可

[root@users 6.3.2]# ansible-playbook mysqlconf.yml

PLAY [localhost] ***************************************************************

TASK [template] ****************************************************************
changed: [localhost]

PLAY RECAP *********************************************************************
localhost                  : ok=1    changed=1    unreachable=0    failed=0




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值