ricsanfre.iscsi_initiator
Ansible Role: iSCSI Initiator
This role sets up a Linux server to act as an iSCSI initiator using open-iscsi
.
It also modifies the open-iscsi community module to allow for mutual authentication. The modified module can be found in library/open_iscsi.py
.
Requirements
None.
Role Variables
Below are the available variables with their default values (see defaults\main.yaml
). To set up the iSCSI initiator, configure the following variables:
- iSCSI initiator IQN
open_iscsi_initiator_name: "iqn.2021-07.com.ricsanfre:{{ ansible_facts['nodename'] }}"
- iSCSI daemon configuration including automatic login and authentication setup
# Configuration for open-iscsi
open_iscsi_initiator_name: iqn.2021-07.com.ricsanfre:iscsi-initiator
open_iscsi_authentication: true
open_iscsi_auth_username: iqn.2021-07.com.ricsanfre:iscsi-initiator
open_iscsi_auth_password: s1cret0
open_iscsi_auth_username_in: iqn.2021-07.com.ricsanfre:iscsi-target
open_iscsi_auth_password_in: 0tr0s1cret0
open_iscsi_automatic_startup: true
NOTE: Other iSCSI daemon parameters can also be configured.
- iSCSI Targets to connect to
open_iscsi_targets:
- name: 'Target'
discover: true
auto_portal_startup: true
auto_node_startup: true
portal: '196.168.0.1'
target: 'iqn.2001-04.org.example:target'
login: true
Dependencies
None.
Example Playbook
This example uses the ricsanfre.storage
role to create the logical volumes needed for the iSCSI target.
It also demonstrates how to use specific authentication methods and credentials for each target.
- name: Configure iscsi-client
hosts: iscsi-initiator
become: true
gather_facts: true
vars:
open_iscsi_authentication: true
open_iscsi_automatic_startup: true
open_iscsi_targets:
- name: iscsi-target
discover: true
auto_portal_startup: true
auto_node_startup: true
portal: 192.168.0.11
target: iqn.2021-07.com.ricsanfre:iscsi-target
login: true
node_auth: CHAP
node_user: iqn.2021-07.com.ricsanfre:iscsi-initiator
node_pass: s1cret0
node_user_in: iqn.2021-07.com.ricsanfre:iscsi-target
node_pass_in: 0tr0s1cret0
roles:
- ricsanfre.iscsi_initiator
License
MIT
Author Information
Created by Ricardo Sanchez (ricsanfre)
Installa
ansible-galaxy install ricsanfre.iscsi_initiator
Licenza
mit
Download
11.1k
Proprietario
Telecom engineer.