cdomingos.multipath
Ansible Role: Multipath (DM Multipath)
This Ansible role is designed to properly install and configure the Linux multipathing software (DM Multipath) for either Boot from SAN or Local Boot.
Features of the Multipath Role:
- Configures DM Multipath following product guidelines and best practices.
- Adjusts driver settings.
Important Note
This role will overwrite existing DM Multipath settings.
Please check the multipath_backup_permanent
variable in the Role Variables section.
This setup impacts the following directories and files:
/etc/multipath/
/etc/multipath.conf
Caution:
If there are issues after rebooting the host, you might encounter errors like Kernel panic on boot with "dracut Warning: LVM rootvg/rootlv not found"
.
In such cases, you should:
- Boot the system using a Rescue ISO.
- Restore the main files:
- /boot/<original-initramfs>.img.ansible_multipath
- /etc/fstab.ansible_multipath
- /etc/lvm/lvm.conf.ansible_multipath
Tip: You can troubleshoot issues by changing kernel boot parameters to rdshell
or rd.shell
and removing rhgb
and quiet
.
How It Works
There are two main stages: pre-setup and setup.
Pre-setup: No system changes, except for installing packages if specified:
- Checks if the device-mapper-multipath package is installed.
- Gathers details about devices for
/boot
and/boot/efi
. - Loads necessary drivers based on the discovered boot disk.
- Determines if the configuration is for Boot from SAN.
- Retrieves GRUB's default kernel and initramfs.
- Sets up device names and LVM filters.
Setup: Makes system changes:
- Backs up files like
/etc/fstab
and the current initramfs. - Removes the current DM Multipath configuration.
- Creates a new
/etc/multipath.conf
file and checks for errors. - Configures
/etc/fstab
, LVM filters, modprobe files, and initramfs, checking for errors along the way. - On errors, it cleans up and restores backup files.
- Reboots the system and deletes previous backups.
Requirements
- The playbook must use
become: yes
for root privileges andgather_facts: yes
. - Requires Ansible Engine version 2.7.1 or higher.
Role Variables
Variables for configuring the multipath role start with multipath_
. Here are some key ones:
Variable | Type | Description |
---|---|---|
multipath_setup_pseudodevname |
string (mandatory) | Sets the name for the boot disk managed by DM Multipath. |
multipath_package_install |
boolean (optional) | Installs the device-mapper-multipath package if missing. |
multipath_package_upgrade |
boolean (recommended) | Upgrades the device-mapper-multipath package if necessary. |
multipath_preserve_currentfiles |
boolean (recommended) | Backs up existing configuration files before setup. |
multipath_reboot_allow |
boolean (recommended) | Allows the role to reboot the managed node. |
multipath_reboot_timeoutguest |
integer (optional) | Maximum wait time (in seconds) for guests to reboot. |
multipath_reboot_timeoutbaremetal |
integer (optional) | Maximum wait time (in seconds) for bare metal systems to reboot. |
multipath_debug_showvariables |
boolean (recommended) | Displays role variables and their values. |
Example Playbook
Here's what a simple playbook might look like:
- hosts: servers
become: yes
gather_facts: yes
roles:
- cdomingos.multipath
License
MIT
Author Information
Created by Cláudio Domingos in 2019.
Additional Information
Tested on:
- HP ProLiant BL460c Gen9 (UEFI)
- 3PAR Storage Array
- RHEL 6, 7, 8
- Fedora 31
This role is particularly useful for Bare Metal machines, as high-availability multipathing software needs to be at the hypervisor level.
For best practices in configuring DM Multipath with specific Storage Arrays, consult your Storage Array vendor or seek the Host Connectivity Guide for Linux.
TODO
- Resolve critical issues like
dracut Warning: LVM rootvg/rootlv not found
by implementing fallback scripts in case of system crashes during reboots.
Configure native linux multipathing (DM Multipath) for Boot from SAN or Local Boot
ansible-galaxy install cdomingos.multipath