# Ansible- libselinux-python Error

**URL:** <https://forum.ansible.com/t/ansible-libselinux-python-error/33569>\
**Category:** Ansible Project\
**Created:** [August 7, 2020, 10:42pm UTC](https://forum.ansible.com/t/ansible-libselinux-python-error/33569 "2020-08-07T22:42:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nagesh\_sheregar](https://avatars.discourse-cdn.com/v4/letter/n/3ec8ea/32.png) [@Nagesh\_sheregar](https://forum.ansible.com/u/Nagesh_sheregar)\
**Post date:** [August 7, 2020, 10:42pm UTC](https://forum.ansible.com/t/ansible-libselinux-python-error/33569/1 "2020-08-07T22:42:53Z")

</div>

Hi Team,

i am getting bellow error:

i can see libselinux-python installed but i am getting below error not sure why

[root@s605141sl7vl402 ansible]# rpm -qa | grep libselinux-python  
libselinux-python-2.5-15.el7.x86\_64  
[root@s605141sl7vl402 ansible]#

TASK [firmware : connect the VC] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
task path: /data01/ansible/playbooks/roles/firmware/tasks/nic.yml:2  
\<127.0.0.1\> ESTABLISH LOCAL CONNECTION FOR USER: root  
\<127.0.0.1\> EXEC /bin/sh -c ‘echo ~root && sleep 0’  
\<127.0.0.1\> EXEC /bin/sh -c ‘( umask 77 && mkdir -p “`echo /root/.ansible/tmp`”&& mkdir /root/.ansible/tmp/ansible-tmp-1596839965.56-8623-255860923309448 && echo ansible-tmp-1596839965.56-8623-255860923309448=“`echo /root/.ansible/tmp/ansible-tmp-1596839965.56-8623-255860923309448`” ) && sleep 0’  
\<127.0.0.1\> EXEC /bin/sh -c ‘echo ~root && sleep 0’  
Using module file /usr/lib/python2.7/site-packages/ansible/modules/files/stat.py  
\<127.0.0.1\> PUT /root/.ansible/tmp/ansible-local-8543Bm9eWG/tmpeIAjnY TO /root/.ansible/tmp/ansible-tmp-1596839965.56-8623-255860923309448/AnsiballZ\_stat.py  
\<127.0.0.1\> EXEC /bin/sh -c ‘chmod u+x /root/.ansible/tmp/ansible-tmp-1596839965.56-8623-255860923309448/ /root/.ansible/tmp/ansible-tmp-1596839965.56-8623-255860923309448/AnsiballZ\_stat.py && sleep 0’  
\<127.0.0.1\> EXEC /bin/sh -c ‘/opt/rh/python27/root/usr/bin/python2 /root/.ansible/tmp/ansible-tmp-1596839965.56-8623-255860923309448/AnsiballZ\_stat.py && sleep 0’  
\<127.0.0.1\> PUT /root/.ansible/tmp/ansible-local-8543Bm9eWG/tmpvSF4kk/nic.ps1.j2 TO /root/.ansible/tmp/ansible-tmp-1596839965.56-8623-255860923309448/source  
\<127.0.0.1\> EXEC /bin/sh -c ‘chmod u+x /root/.ansible/tmp/ansible-tmp-1596839965.56-8623-255860923309448/ /root/.ansible/tmp/ansible-tmp-1596839965.56-8623-255860923309448/source && sleep 0’  
Using module file /usr/lib/python2.7/site-packages/ansible/modules/files/copy.py  
\<127.0.0.1\> PUT /root/.ansible/tmp/ansible-local-8543Bm9eWG/tmpn4OyUE TO /root/.ansible/tmp/ansible-tmp-1596839965.56-8623-255860923309448/AnsiballZ\_copy.py  
\<127.0.0.1\> EXEC /bin/sh -c ‘chmod u+x /root/.ansible/tmp/ansible-tmp-1596839965.56-8623-255860923309448/ /root/.ansible/tmp/ansible-tmp-1596839965.56-8623-255860923309448/AnsiballZ\_copy.py && sleep 0’  
\<127.0.0.1\> EXEC /bin/sh -c ‘/opt/rh/python27/root/usr/bin/python2 /root/.ansible/tmp/ansible-tmp-1596839965.56-8623-255860923309448/AnsiballZ\_copy.py && sleep 0’  
\<127.0.0.1\> EXEC /bin/sh -c ‘rm -f -r /root/.ansible/tmp/ansible-tmp-1596839965.56-8623-255860923309448/ \> /dev/null 2\>&1 && sleep 0’  
fatal: [localhost]: FAILED! =\> {  
“changed”: false,  
“checksum”: “1f4ebaebaf1be3adbe5f2c2c9b4bf1bf84c9ce9a”,  
“diff”: ,  
“invocation”: {  
“module\_args”: {  
“\_original\_basename”: “nic.ps1.j2”,  
“attributes”: null,  
“backup”: false,  
“checksum”: “1f4ebaebaf1be3adbe5f2c2c9b4bf1bf84c9ce9a”,  
“content”: null,  
“delimiter”: null,  
“dest”: “/root/script.ps1”,  
“directory\_mode”: null,  
“follow”: false,  
“force”: true,  
“group”: null,  
“local\_follow”: null,  
“mode”: null,  
“owner”: null,  
“regexp”: null,  
“remote\_src”: null,  
“selevel”: null,  
“serole”: null,  
“setype”: null,  
“seuser”: null,  
“src”: “/root/.ansible/tmp/ansible-tmp-1596839965.56-8623-255860923309448/source”,  
“unsafe\_writes”: null,  
“validate”: null  
}  
},  
“msg”: “Aborting, target uses selinux but python bindings (libselinux-python) aren’t installed!”  
}

---

<div class="post-metadata">

**Author:** ![sivel](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/sivel/32/1198_2.png) [@sivel](https://forum.ansible.com/u/sivel)\
**Post date:** [August 7, 2020, 10:48pm UTC](https://forum.ansible.com/t/ansible-libselinux-python-error/33569/2 "2020-08-07T22:48:34Z")

</div>

It appears as though you are using an SCL python:

/opt/rh/python27/root/usr/bin/python2

The libselinux-python package is not available to the SCL, and selinux python bindings are not provided for SCLs.

---

<div class="post-metadata">

**Author:** ![Nagesh\_sheregar](https://avatars.discourse-cdn.com/v4/letter/n/3ec8ea/32.png) [@Nagesh\_sheregar](https://forum.ansible.com/u/Nagesh_sheregar)\
**Post date:** [August 8, 2020, 1:34am UTC](https://forum.ansible.com/t/ansible-libselinux-python-error/33569/3 "2020-08-08T01:34:47Z")

</div>

i fixed the issue

i removed below entry from the var file:

ansible\_python\_interpreter: ‘/opt/rh/python27/root/usr/bin/python2’

Thank you
