-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdisable-unnecessary-filesystem.yaml
44 lines (40 loc) · 1.52 KB
/
disable-unnecessary-filesystem.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
- hosts: all
become: yes
become_user: root
become_method: sudo
remote_user: sys-admin
tasks:
- name: Create required file for rhel-7
copy:
dest: /etc/modprobe.d/disable-filesystems.conf
content: |
install cramfs /bin/true
install squashfs /bin/true
install udf /bin/true
when: (ansible_facts['distribution'] == "RedHat" and ansible_facts['distribution_major_version'] == "7")
- name: Create required file for rhel-8
copy:
dest: /etc/modprobe.d/disable-filesystems.conf
content: |
install cramfs /bin/false
install squashfs /bin/false
install udf /bin/false
blacklist cramfs
blacklist squashfs
blacklist udf
when: (ansible_facts['distribution'] == "RedHat" and ansible_facts['distribution_major_version'] == "8")
- name: Create required file for rhel-9
copy:
dest: /etc/modprobe.d/blacklist.conf
content: |
install cramfs /bin/false
install squashfs /bin/false
install udf /bin/false
blacklist cramfs
blacklist squashfs
blacklist udf
when: (ansible_facts['distribution'] == "RedHat" and ansible_facts['distribution_major_version'] == "9")
- name: Remove cramfs squashfs udf module from kernel
shell: modprobe -r cramfs; modprobe -r squashfs; modprobe -r udf
ignore_errors: true
when: (ansible_facts['distribution'] == "RedHat" and ansible_facts['distribution_major_version'] <= "9")