isca0.mpath
Mpath
Overview
Mpath helps you install, mount, or unmount iSCSI block storage using multipath capabilities. It works with SoftLayer block storage and other iSCSI multipath setups.
Functionality
During Installation
- Install necessary packages for multipath and iSCSI.
- Configure the
/etc/multipath.conf
file. - Load the
dm-multipath
kernel module. - Start the
multipathd
service. - Use
multipath -l
to initialize the multipath handler. - Set up the iSCSI initiator name in
/etc/iscsi/initiatorname.iscsi
. - Edit CHAP authentication in
/etc/iscsi/iscsid.conf
. - Attempt to log in automatically; if it fails, use manual login.
- Create an alias in
/etc/multipath/bindings
. - Mount the multipath device from
/dev/mapper/mydeviceid
to/mnt/myaliasname
. - Start and enable iSCSI and
iscsid
. - Add entries to
/etc/fstab
.
During Unmounting
- Check which processes are using the device with
lsof
. - If the device is in use, force release it.
- Use lazy unmount (
umount -l device
). - Remove entries from
/etc/fstab
. - Flush multipath settings with
multipath -f device
. - Log out from the session portal target.
- Stop and disable iSCSI,
iscsid
, andmultipathd
services.
Requirements
You'll need the iSCSI multipath block storage, including the login credentials for the IQN and the complete initiator IQN path, like /dev/mapper/3600...
.
Role Variables
These variables should be modified in your playbook:
iscsint: iSCSI initiator IQN name.
Example:
iscsint: iqn.1994-05.com.redhat:47c98423c167
You can set multiple initiators:
iscsint: - iqn.1994-05.com.redhat:47c98423c167 - iqn.1994-05.com.redhat:47c98423c167-2 - iqn.1994-05.com.redhat:47c98423c167-3
mpathip: IP address of the target.
mpathip: 10.150.10.20
filesystem: Default is ext4; change it as needed.
map: If true, installation and configuration tasks run. If false, it unmounts the device.
wwid: Alias for the multipath device, crucial for bindings and operations.
Syntax:
wwid: - { id: '360009827346', alias: 'mylun0' } - { id: '360782378662', alias: 'mylun1' }
packs: Packages to install (iSCSI, multipath, lsof).
credentials: Your login and password, no quotes.
Example:
credentials: - name: "My Credentials" login: mylogin pass: mypassword
Dependencies
No dependencies required.
Example Playbook
Here's how to use the role to install and mount a multipath device:
- name: "Deploy | Running isca0.mpath role"
hosts: somehost
become: yes
remote_user: myuser
vars:
mpathip: "10.200.10.100"
credentials:
- name: "Multipath"
login: MyLogin
pass: Mypassword
iscsint:
- "iqn.1994-05.com.redhat:47c98423c167"
wwid:
- { id: '3600a0980383888835645961', alias: 'blk' }
roles:
- mpath
To unmount a device on several hosts and then mount it on a specific host, you can run an unmount playbook first and then the installation/mounting playbook.
Here’s a sample unmount playbook:
- name: "Deploy | Running isca0.mpath role"
hosts: groupofhosts
become: yes
remote_user: myuser
vars:
map: false
mpathip: "10.200.10.100"
wwid:
- { id: '3600a098038303631a35645961', alias: 'blk' }
roles:
- mpath
Just set map to false to perform only unmount tasks.
To-do
- Add support for automount.
License
LGPL-3.0
Author Information
This role was created in 2017 by isca.