AnsiblePilot — Master Ansible Automation

AnsiblePilot is the leading resource for learning Ansible automation, DevOps, and infrastructure as code. Browse over 1,400 tutorials covering Ansible modules, playbooks, roles, collections, and real-world examples. Whether you are a beginner or an experienced engineer, our step-by-step guides help you automate Linux, Windows, cloud, containers, and network infrastructure.

Popular Topics

About Luca Berton

Luca Berton is an Ansible automation expert, author of 8 Ansible books published by Apress and Leanpub including "Ansible for VMware by Examples" and "Ansible for Kubernetes by Example", and creator of the Ansible Pilot YouTube channel. He shares practical automation knowledge through tutorials, books, and video courses to help IT professionals and DevOps engineers master infrastructure automation.

Ansible modprobe: Load & Unload Linux Kernel Modules (Guide) — Video Tutorial

How to load and unload Linux kernel modules with Ansible modprobe module. Manage drivers, configure module parameters, and persist across reboots with examples.

Watch Video

Watch "Ansible modprobe: Load & Unload Linux Kernel Modules (Guide)" on YouTube

What You'll Learn

Full Tutorial Content

How to Load and Unload Kernel Modules in Linux with Ansible? I'm going to show you a live Playbook with some simple Ansible code. I'm Luca Berton and welcome to today's episode of Ansible Pilot. Ansible Load and Unload Kernel Modules in Linux - community.general.modprobe - Load or unload kernel modules Today we're talking about the Ansible module modprobe. The full name is `community.general.modprobe`, which means that is part of the collection of modules "community.general" maintained by the Ansible Community. The purpose of the module is to Load or unload kernel modules. Parameters - name string - Name of kernel module - params string - Modules parameters - state string - present/absent - Load / Unload The parameters of the module modprobe. The only required parameter is "name", with the full Linux kernel module name. The parameter "params" allows you to specify some module parameters. Default is an empty string. The parameter "state" specifies the status of the Linux Kernel module. The option "present" means that the module must be loaded. The option "absent" means that the module must be unloaded. Links - https://docs.ansible.com/ansible/latest/collections/community/general/modprobe_module.html ## Playbook Load and Unload Kernel Modules in Linux with Ansible Playbook. code ```yaml --- - name: modprobe module Playbook hosts: all become: true vars: module_name: "dummy" module_params: "numdummies=2" tasks: - name: load the module community.general.modprobe: name: "{{ module_name }}" state: present params: "{{ module_params }}" ``` execution ```bash $ ansible-playbook -i virtualmachines/demo/inventory modprobe/modprobe.yml PLAY [modprobe module Playbook] *********************************************************************** TASK [Gathering Facts] **************************************************************************** ok: [demo.example.com] TASK [Add the dummy module] *********************************************************************** changed: [demo.example.com] PLAY RECAP **************************************************************************************** demo.example.com : ok=2 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 idempotency $ ansible-playbook -i virtualmachines/demo/inventory modprobe/modprobe.yml PLAY [modprobe module Playbook] *********************************************************************** TASK [Gathering Facts] **************************************************************************** ok: [demo.example.com] TASK [Add the dummy module] *********************************************************************** ok: [demo.example.com] PLAY RECAP **************************************************************************************** demo.example.com : ok=2 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 ``` before execution ```bash $ ssh devops@demo.example

About This Tutorial

Read the full written article: Ansible modprobe: Load & Unload Linux Kernel Modules (Guide)

Topics Covered

Related Video Tutorials