[Python] Aborting, target uses selinux but Python bindings (libselinux-Python) aren't installed

Discussão em 'Python' iniciado por Stack, Julho 22, 2025.

  1. Stack

    Stack Membro Participativo

    I am trying to run Ansible playbook command and getting an error as below.


    fatal: [localhost]: FAILED! => {"changed": false, "msg": "Aborting, target
    uses selinux but python bindings (libselinux-python) aren't installed!"}​

    When I checked for libselinux-python, it showsit is already available.

    [root@host all]# sudo yum list installed |grep libselinux-python
    libselinux-python3.x86_64 2.5-15.el7 @rhel-7-server-rpms


    Please provide your input if anyone has faced and resolved this.

    Below are my Python and Ansible versions installed on server.

    [root@ xxx bin]# python --version
    Python 3.6.5

    [root@xxx bin]# which python
    /root/.pyenv/shims/python

    [root@xxx bin]# ansible --version
    ansible 2.9.9
    config file = /etc/ansible/ansible.cfg
    configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
    ansible python module location = /root/.pyenv/versions/3.6.5/lib/python3.6/site-packages/ansible
    executable location = /root/.pyenv/versions/3.6.5/bin/ansible
    python version = 3.6.5 (default, Jun 18 2020, 17:32:20) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]

    [root@ xxx bin]#

    Continue reading...

Compartilhe esta Página