Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implemented user authentication and parameter #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,28 @@ iscsi_targets:
initiators:
- 'iqn.1994-05.com.redhat:client1'
- 'iqn.1994-05.com.redhat:client2'
initiators_auth:
iqn.1994-05.com.redhat:client1:
user: client1_user
password: client1_password
iqn.1994-05.com.redhat:client2
user: client2_user
password: client2_password
attributes: "demo_mode_write_protect=0"
parameters: "MaxConnections=2 TargetAlias=my_target"
auth: "mutual_userid=my_target_user mutual_password=my_target_password"

Note:
initiators_auth: optional
attributes: optional
these are the attributes supported by targetcli under /iscsi/<wwn>/tpg1
refer to "targetcli '/iscsi/<wwn>/tpg1 get attribute' for list of supported attributes
parameters: optional
these are the parameters supported by targetcli under /iscsi/<wwn>/tpg1
refer to "targetcli '/iscsi/<wwn>/tpg1 get parameter' for list of supported parameters
auth: optional
these are the authentication properties supported by targetcli under /iscsi/<wwn>/tpg1
refer to "targetcli '/iscsi/<wwn>/tpg1 get auth' for list of supported authentication properties
```

Example Playbook
Expand Down
6 changes: 6 additions & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
- name: create iSCSI targets
targetcli_iscsi:
wwn: "{{ item.wwn }}"
attributes: "{{ item.attributes | default('') }}"
parameters: "{{ item.parameters | default('') }}"
auth: "{{ item.auth | default('') }}"
with_items: "{{ iscsi_targets }}"
notify:
- save targetcli configuration
Expand All @@ -40,11 +43,14 @@
targetcli_iscsi_acl:
wwn: "{{ item.0.wwn }}"
initiator_wwn: "{{ item.1 }}"
initiator_user: "{{ item[0]['initiators_auth'][item.1]['user'] | default('') }}"
initiator_password: "{{ item[0]['initiators_auth'][item.1]['password'] | default('') }}"
with_subelements:
- "{{ iscsi_targets }}"
- initiators
notify:
- save targetcli configuration
#no_log: true
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should not be present here but in OndrejHome.targetcli-modules ansible role modules


- name: assing LUNs to initiators
targetcli_iscsi_lun:
Expand Down