1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

open-iscsi: adding mutual authentication support and updating authentication parameters description (#3422) (#3447)

* Adding mutual athentication support and changing doucumentation about authentication credentials

* Removing blank line with whitspaces

* Update plugins/modules/system/open_iscsi.py

Adding version_added to node_user_in parameter

Co-authored-by: Ajpantuso <ajpantuso@gmail.com>

* Update plugins/modules/system/open_iscsi.py

adding version_added attibute to new parameter password_in

Co-authored-by: Ajpantuso <ajpantuso@gmail.com>

* Update plugins/modules/system/open_iscsi.py

Co-authored-by: Ajpantuso <ajpantuso@gmail.com>

* Adding changelog fragment for #3422

* Rename 3422-open-iscsi-mutual-authentication-support.yam to 3422-open-iscsi-mutual-authentication-support.yaml

* Update changelogs/fragments/3422-open-iscsi-mutual-authentication-support.yaml

Co-authored-by: Ajpantuso <ajpantuso@gmail.com>

* Update changelogs/fragments/3422-open-iscsi-mutual-authentication-support.yaml

Co-authored-by: Ajpantuso <ajpantuso@gmail.com>

Co-authored-by: Ajpantuso <ajpantuso@gmail.com>
(cherry picked from commit 43a9f09a17)

Co-authored-by: Ricardo Sanchez <84853324+ricsanfre@users.noreply.github.com>
This commit is contained in:
patchback[bot] 2021-09-26 13:49:02 +02:00 committed by GitHub
parent 5c1fa53558
commit 29211b970c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 28 additions and 4 deletions

View file

@ -0,0 +1,3 @@
---
minor_changes:
- open-iscsi - adding support for mutual authentication between target and initiator (https://github.com/ansible-collections/community.general/pull/3422).

View file

@ -41,17 +41,27 @@ options:
aliases: [ state ] aliases: [ state ]
node_auth: node_auth:
description: description:
- The value for C(discovery.sendtargets.auth.authmethod). - The value for C(node.session.auth.authmethod).
type: str type: str
default: CHAP default: CHAP
node_user: node_user:
description: description:
- The value for C(discovery.sendtargets.auth.username). - The value for C(node.session.auth.username).
type: str type: str
node_pass: node_pass:
description: description:
- The value for C(discovery.sendtargets.auth.password). - The value for C(node.session.auth.password).
type: str type: str
node_user_in:
description:
- The value for C(node.session.auth.username_in).
type: str
version_added: 3.8.0
node_pass_in:
description:
- The value for C(node.session.auth.password_in).
type: str
version_added: 3.8.0
auto_node_startup: auto_node_startup:
description: description:
- Whether the target node should be automatically connected at startup. - Whether the target node should be automatically connected at startup.
@ -191,6 +201,8 @@ def target_login(module, target, portal=None, port=None):
node_auth = module.params['node_auth'] node_auth = module.params['node_auth']
node_user = module.params['node_user'] node_user = module.params['node_user']
node_pass = module.params['node_pass'] node_pass = module.params['node_pass']
node_user_in = module.params['node_user_in']
node_pass_in = module.params['node_pass_in']
if node_user: if node_user:
params = [('node.session.auth.authmethod', node_auth), params = [('node.session.auth.authmethod', node_auth),
@ -200,6 +212,13 @@ def target_login(module, target, portal=None, port=None):
cmd = [iscsiadm_cmd, '--mode', 'node', '--targetname', target, '--op=update', '--name', name, '--value', value] cmd = [iscsiadm_cmd, '--mode', 'node', '--targetname', target, '--op=update', '--name', name, '--value', value]
module.run_command(cmd, check_rc=True) module.run_command(cmd, check_rc=True)
if node_user_in:
params = [('node.session.auth.username_in', node_user_in),
('node.session.auth.password_in', node_pass_in)]
for (name, value) in params:
cmd = '%s --mode node --targetname %s --op=update --name %s --value %s' % (iscsiadm_cmd, target, name, value)
module.run_command(cmd, check_rc=True)
cmd = [iscsiadm_cmd, '--mode', 'node', '--targetname', target, '--login'] cmd = [iscsiadm_cmd, '--mode', 'node', '--targetname', target, '--login']
if portal is not None and port is not None: if portal is not None and port is not None:
cmd.append('--portal') cmd.append('--portal')
@ -277,6 +296,8 @@ def main():
node_auth=dict(type='str', default='CHAP'), node_auth=dict(type='str', default='CHAP'),
node_user=dict(type='str'), node_user=dict(type='str'),
node_pass=dict(type='str', no_log=True), node_pass=dict(type='str', no_log=True),
node_user_in=dict(type='str'),
node_pass_in=dict(type='str', no_log=True),
# actions # actions
login=dict(type='bool', aliases=['state']), login=dict(type='bool', aliases=['state']),
@ -286,7 +307,7 @@ def main():
show_nodes=dict(type='bool', default=False), show_nodes=dict(type='bool', default=False),
), ),
required_together=[['node_user', 'node_pass']], required_together=[['node_user', 'node_pass'], ['node_user_in', 'node_pass_in']],
required_if=[('discover', True, ['portal'])], required_if=[('discover', True, ['portal'])],
supports_check_mode=True, supports_check_mode=True,
) )