Environment
- YugabyteDB Anywhere - When deploying with Python > v3.6
Issue
Universe creation or Node Add operations fail with the following Ansible error:
TASK [server_base : <Task Name>] *******************
Monday 30 May 2023 05:45:32 +0000 (0:00:00.000) 0:00:00.000 ****
fatal: [<hostname>]: FAILED! => changed=false
module_stderr: ''
module_stdout: ''
msg: |-
MODULE FAILURE
See stdout/stderr for the exact error
rc: 1.
This error can occur if the selinux
Python module is not installed, or if the SSH User specified in the Config Details of your Provider Integration does not have access to this module.
Resolution
Overview
The resolution involves:
- As root, Installing the
selinux
module - Ensuring that the modules directory has 755 permissions
- Ensuring that the SSH User can import the
selinux
module without errors
Steps
Note: These steps should be performed on all DB nodes
1. As root, install the selinux
module
root@example# python3 -m pip install selinux
2. As root, import selinux
without errors
root@example# python3
Python 3.10.12 (main, Feb 4 2025, 14:57:36) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import selinux
>>>
Note: Here we see no output. This is desired, as it means there were no errors
3. In the same Python session, run the help()
function on selinux
>>> help('selinux')
The result will be a man page like this -- In the FILE
section at the bottom, make a note of the module path
In my case, packages are stored in /usr/local/lib/python3.10/
4. As root, set the permissions of the python3.x directory to 755, using -R
for recursive:
root@example:# chmod -R 755 /usr/local/lib/python3.10/
Note: This step ensures that the SSH User will be able to access the module
5. As root, confirm that the permissions of the python3.x directory are 755
root@example:# ls -lrt /usr/local/lib/
total 4
drwxr-xr-x 3 root root 4096 Feb 17 2023 python3.10
6. As the SSH User, ensure that you can import the selinux
module
$ python3
Python 3.10.12 (main, Feb 4 2025, 14:57:36) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import selinux
>>>
Note: The above steps should be performed on all DB nodes before proceeding to step 7
7. Retry the Universe creation or Node Add task in the YugabyteDB Anywhere UI
Additional Information
Python versions <= v3.6 included the selinux
module in the default Python install.
However, Python versions > v3.6 do not include this module in the default install. This is why it needs to be installed explicitly.
Comments
0 comments
Please sign in to leave a comment.