Files
Ansible-roles/common/tasks/kernel_modules.yml
T

22 lines
813 B
YAML

# A container shares the kernel of its host, so the host loads the modules for it.
- block:
- name: Load kernel modules at boot
ansible.builtin.copy:
dest: /etc/modules-load.d/ansible.conf
content: "{{ kernel_modules | join('\n') }}\n"
mode: "0644"
when: kernel_modules | length > 0
- name: Remove the boot list of kernel modules
ansible.builtin.file:
path: /etc/modules-load.d/ansible.conf
state: absent
when: kernel_modules | length == 0
- name: Load kernel modules now
community.general.modprobe:
name: "{{ item }}"
state: present
loop: "{{ kernel_modules }}"
when: ansible_facts['virtualization_type'] not in ['lxc', 'docker', 'podman', 'container'] or ansible_facts['virtualization_role'] != 'guest'