Skip to content
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

Module 'selinux' has no attribute 'selinux_getpolicytype' on Oracle Linux 9 #502

Open
cstrizzolo opened this issue Oct 19, 2023 · 0 comments

Comments

@cstrizzolo
Copy link

cstrizzolo commented Oct 19, 2023

SUMMARY

The following task:

- name: Set SELinux state
  ansible.posix.selinux:
    state: disabled

triggers the following error:

An exception occurred during task execution. To see the full traceback, use -vvv. The error was: AttributeError: module 'selinux' has no attribute 'selinux_getpolicytype'
fatal: [linadm.ts.infn.it]: FAILED! => {"changed": false, "module_stderr": "Traceback (most recent call last):\n  File \"<stdin>\", line 107, in <module>\n  File \"<stdin>\", line 99, in _ansiballz_main\n  File \"<stdin>\", line 47, in invoke_module\n  File \"<frozen runpy>\", line 226, in run_module\n  File \"<frozen runpy>\", line 98, in _run_module_code\n  File \"<frozen runpy>\", line 88, in _run_code\n  File \"/tmp/ansible_ansible.posix.selinux_payload_8fkxu1fj/ansible_ansible.posix.selinux_payload.zip/ansible_collections/ansible/posix/plugins/modules/selinux.py\", line 346, in <module>\n  File \"/tmp/ansible_ansible.posix.selinux_payload_8fkxu1fj/ansible_ansible.posix.selinux_payload.zip/ansible_collections/ansible/posix/plugins/modules/selinux.py\", line 248, in main\nAttributeError: module 'selinux' has no attribute 'selinux_getpolicytype'\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}

The same happens if I try to set the "policy: targeted" attribute instead of the state attribute.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

ansible.posix.selinux

ANSIBLE VERSION
ansible [core 2.14.2]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.11/site-packages/ansible
  ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.11.2 (main, Oct  6 2023, 00:00:00) [GCC 11.3.1 20221121 (Red Hat 11.3.1-4.3.0.4)] (/usr/bin/python3.11)
  jinja version = 3.1.2
  libyaml = True
COLLECTION VERSION
# ansible-galaxy collection list ansible.posix

# /usr/share/ansible/collections/ansible_collections
Collection    Version
------------- -------
ansible.posix 1.5.4  

# /usr/lib/python3.11/site-packages/ansible_collections
Collection    Version
------------- -------
ansible.posix 1.5.1  
CONFIGURATION
ANSIBLE_PIPELINING(/etc/ansible/ansible.cfg) = True
CACHE_PLUGIN(/etc/ansible/ansible.cfg) = jsonfile
CACHE_PLUGIN_CONNECTION(/etc/ansible/ansible.cfg) = /tmp/ansible_facts_cache
CACHE_PLUGIN_TIMEOUT(/etc/ansible/ansible.cfg) = 21600
CONFIG_FILE() = /etc/ansible/ansible.cfg
DEFAULT_FORKS(/etc/ansible/ansible.cfg) = 90
DEFAULT_GATHERING(/etc/ansible/ansible.cfg) = smart
DEFAULT_NO_TARGET_SYSLOG(/etc/ansible/ansible.cfg) = True
DISPLAY_SKIPPED_HOSTS(/etc/ansible/ansible.cfg) = False
MAX_FILE_SIZE_FOR_DIFF(/etc/ansible/ansible.cfg) = 1048576
PERSISTENT_COMMAND_TIMEOUT(/etc/ansible/ansible.cfg) = 300

OS / ENVIRONMENT
# cat /etc/oracle-release 
Oracle Linux Server release 9.2

##### STEPS TO REPRODUCE
See above

##### EXPECTED RESULTS
The task should set the selinux state without errors.

ACTUAL RESULTS

See above

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant