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

  1. Install necessary packages for multipath and iSCSI.
  2. Configure the /etc/multipath.conf file.
  3. Load the dm-multipath kernel module.
  4. Start the multipathd service.
  5. Use multipath -l to initialize the multipath handler.
  6. Set up the iSCSI initiator name in /etc/iscsi/initiatorname.iscsi.
  7. Edit CHAP authentication in /etc/iscsi/iscsid.conf.
  8. Attempt to log in automatically; if it fails, use manual login.
  9. Create an alias in /etc/multipath/bindings.
  10. Mount the multipath device from /dev/mapper/mydeviceid to /mnt/myaliasname.
  11. Start and enable iSCSI and iscsid.
  12. Add entries to /etc/fstab.

During Unmounting

  1. Check which processes are using the device with lsof.
  2. If the device is in use, force release it.
  3. Use lazy unmount (umount -l device).
  4. Remove entries from /etc/fstab.
  5. Flush multipath settings with multipath -f device.
  6. Log out from the session portal target.
  7. Stop and disable iSCSI, iscsid, and multipathd 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.

Informazioni sul progetto

Manage iscsi blockstorage with multipath on softlayer like a boss

Installa
ansible-galaxy install isca0.mpath
Licenza
lgpl-3.0
Download
75
Proprietario