-1

Below is the error :

FAILED! => {"ansible_facts": {"discovered_interpreter_pyt hon": "/usr/bin/python"}, "changed": false, "checksum": "2ca063f74f5a03d16fb6db0 dba613f2ec60f97b2", "msg": "Aborting, target uses selinux but python bindings (l ibselinux-python) aren't installed!"}

1
  • Welcome to ServerFault. Did you really read the error message? Jul 27, 2021 at 13:25

3 Answers 3

2

You need to install the indicated package on the target host before trying to manipulate user accounts.

On old RHEL/CentOS 7 systems you should install libselinux-python. On modern systems such as RHEL 8 and Fedora it is named python3-libselinux.

0

As the error states, Ansible needs Python bindings for selinux on Linux systems.

For RHEL or Fedora,

yum install libselinux-python*

will install these for python3, and also python2 in the case of RHEL 7.

3
  • The old name libselinux-python does not work on RHEL 8 or Fedora. Jul 22, 2021 at 14:47
  • The wildcard matches libselinux-python3, which is still provided by python3-libselinux last I checked CentOS 8. Jul 22, 2021 at 14:55
  • Not anymore in RHEL 8.4. Jul 22, 2021 at 14:55
0

if you are using a version of ansible that use python2.7 and also your OS is centos 8, follow the below structure:

pip2.7 install selinux

if you did not set your default python to version 2.7 (on target host):

cd /usr/bin/
# below command will create a symbolic link to python2.7
ln -s python2.7 python

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .