-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Known issue with virtualenv and ansible on SELinux-enabled hosts #356
Comments
Another alternative is to create the virtualenv with system packages enabled:
|
Thanks for the post people, I can confirm that the following workaround works for Fedora 25, Ansible 2.2.0.0, Python 2.7.13 ...
Thanks for the work. Thanks @oleyka |
Another workaround is to set the ansible_python_interpreter variable to abolute path of the system installed python interpreter as mentioned in redhat-openstack/tripleo-quickstart@07d0e71
|
Another workaround if you don't want to change This code appends a path to an environment variable that python uses when looking for modules, and only does so for the scope of the task which needs it.
If you have an existing PYTHONPATH you'll want to add something like Warning: probably don't try importing site-packages from across major python versions. Some might work, but python3 and python2 packages aren't naturally compatible. |
(Fedora release 26, ansible 2.5.2, python 2.7.14) Solution A : Worked.
Solution B: Didn't work right away, this is what worked for me:
The "--system-site-packages" parameter worked for me too. But the order seemed to be important. If I tried to put the system-site-packages in the initial setup or not at all then './algo' would fail with the ansible error about libselinux-python. |
OS / Environment
Fedora Linux 25
Ansible version
2.2.1.0
Version of components from
requirements.txt
Summary of the problem
There are some issues with virtualenv, ansible and python on SELinux-based systems. There are two workarounds:
A. set
localhost ansible_python_interpreter=/usr/bin/python
.B. Install python dependencies with
--user
(ex:pip install --user -r requirements.txt
) and rely on system python.Steps to reproduce the behavior
python -m virtualenv env && source env/bin/activate && python -m pip install -r requirements.txt
./algo
The way of deployment (cloud or local)
cloud
Expected behavior
Ansible finds the
libselinux-python
module that is installed into/usr/lib64/python2.7/site-packages/selinux/
.Actual behavior
Aborting, target uses selinux but python bindings (libselinux-python) aren't installed!
Full log
The text was updated successfully, but these errors were encountered: