We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I wanted to blacklist some kernel modules using the ready-made kernel_blacklist in Ansible.
My sample code:
- name: Remove potentially affected (and unused) modules community.general.kernel_blacklist: name: "{{ line_item }}" state: present blacklist_file: "/etc/modprobe.d/{{ line_item }}-blacklist.conf" with_items: - cifs - cls_rsvp loop_control: loop_var: line_item
As I understand it, the module should create such a file and add content to it.
As a result, when you run the playbook, the files are created but their contents are empty:
$ find /etc/modprobe.d/ -size 0 -ls 6030631 0 -rw-r--r-- 1 root root 0 paź 7 12:19 /etc/modprobe.d/cls_rsvp-blacklist.conf 6029638 0 -rw-r--r-- 1 root root 0 paź 7 12:19 /etc/modprobe.d/cifs-blacklist.conf
Additionally, when launching the playbook, I receive a failure message. Below traceback ( -vvv)
The full traceback is: Traceback (most recent call last): File "/tmp/ansible_community.general.kernel_blacklist_payload_rk2m8l96/ansible_community.general.kernel_blacklist_payload.zip/ansible/module_utils/basic.py", line 1003, in set_attributes_if_different raise Exception("Error while setting attributes: %s" % (out + err)) Exception: Error while setting attributes: /tmp/tmpnholykn5: Operation not supported failed: [local] (item=cls_rsvp) => { "ansible_loop_var": "line_item", "changed": false, "details": "Error while setting attributes: /tmp/tmpnholykn5: Operation not supported\n", "gid": 0, "group": "root", "invocation": { "module_args": { "blacklist_file": "/etc/modprobe.d/cls_rsvp-blacklist.conf", "name": "cls_rsvp", "state": "present" } }, "line_item": "cls_rsvp", "mode": "0644", "msg": "chattr failed", "owner": "root", "path": "/tmp/tmpnholykn5", "size": 0, "state": "file", "uid": 0 }
I don't know why module display Error while setting attributes: /tmp/tmpwn_d8ybv: Operation not supported. In bash shell work perfect:
Error while setting attributes: /tmp/tmpwn_d8ybv: Operation not supported
# rm -fv /etc/modprobe.d/cifs-blacklist.conf removed '/etc/modprobe.d/cifs-blacklist.conf' # touch /etc/modprobe.d/cifs-blacklist.conf # echo 'test test' > /etc/modprobe.d/cifs-blacklist.conf
Bug Report
kernel_blacklist
$ ansible --version ansible [core 2.14.10] config file = /etc/ansible/ansible.cfg configured module search path = ['/home/bkida/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules'] ansible python module location = /usr/lib/python3.11/site-packages/ansible ansible collection location = /home/bkida/.ansible/collections:/usr/share/ansible/collections executable location = /usr/bin/ansible python version = 3.11.5 (main, Aug 28 2023, 00:00:00) [GCC 13.2.1 20230728 (Red Hat 13.2.1-1)] (/usr/bin/python3) jinja version = 3.0.3 libyaml = True
$ ansible-galaxy collection list community.general # /usr/lib/python3.11/site-packages/ansible_collections Collection Version ----------------- ------- community.general 6.6.2 # /usr/share/ansible/collections/ansible_collections Collection Version ----------------- ------- community.general 6.6.0
$ ansible-config dump --only-changed CONFIG_FILE() = /etc/ansible/ansible.cfg
Fedora 38
Copy example code from summary description and run on the same ansible / community.general version
Working module ;)
The text was updated successfully, but these errors were encountered:
Files identified in the description:
plugins/modules/kernel_blacklist.py
If these files are incorrect, please update the component name section of the description or use the !component bot command.
component name
!component
click here for bot help
Sorry, something went wrong.
cc @matze click here for bot help
The module copies the current file to a temporary place (while preserving permissions) and atomically moves it back.
The "preserving permissions" part of the first copying step seems to fail.
This extra copying step was added in 2ad7ed4, more specifically in b42ca59. @russoz do you remember why you did it that way?
@felixfontein TBH, not really. But I found a better way to do it.
Successfully merging a pull request may close this issue.
Summary
I wanted to blacklist some kernel modules using the ready-made kernel_blacklist in Ansible.
My sample code:
As I understand it, the module should create such a file and add content to it.
As a result, when you run the playbook, the files are created but their contents are empty:
Additionally, when launching the playbook, I receive a failure message. Below traceback ( -vvv)
I don't know why module display
Error while setting attributes: /tmp/tmpwn_d8ybv: Operation not supported
.In bash shell work perfect:
Issue Type
Bug Report
Component Name
kernel_blacklist
Ansible Version
Community.general Version
Configuration
$ ansible-config dump --only-changed CONFIG_FILE() = /etc/ansible/ansible.cfg
OS / Environment
Fedora 38
Steps to Reproduce
Copy example code from summary description and run on the same ansible / community.general version
Expected Results
Working module ;)
Actual Results
Error while setting attributes: /tmp/tmpwn_d8ybv: Operation not supported
Code of Conduct
The text was updated successfully, but these errors were encountered: