Skip to content

Commit

Permalink
add options for authentication
Browse files Browse the repository at this point in the history
  • Loading branch information
henkwiedig committed Sep 24, 2022
1 parent a6c8078 commit 4c143af
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
2 changes: 2 additions & 0 deletions changelogs/fragments/5306-add-options-for-authentication.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
minor_changes:
- znode - possibility to use zookeeper ACL authentication
25 changes: 24 additions & 1 deletion plugins/modules/clustering/znode.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,18 @@
- Recursively delete node and all its children.
type: bool
default: false
scheme:
description:
- 'Authentication scheme.'
choices: [ digest, sasl ]
type: str
default: "digest"
required: false
credential:
description:
- 'The credential value. Depends on scheme (format "digest": user:password, "sasl": user:password).'
type: str
required: false
requirements:
- kazoo >= 2.1
- python >= 2.6
Expand All @@ -69,6 +81,13 @@
name: /mypath
op: get
- name: Getting the value and stat structure for a znode using digest authentication
community.general.znode:
hosts: 'localhost:2181'
credential: 'user1:s3cr3t'
name: /secretmypath
op: get
- name: Listing a particular znode's children
community.general.znode:
hosts: 'localhost:2181'
Expand Down Expand Up @@ -122,7 +141,9 @@ def main():
op=dict(choices=['get', 'wait', 'list']),
state=dict(choices=['present', 'absent']),
timeout=dict(default=300, type='int'),
recursive=dict(default=False, type='bool')
recursive=dict(default=False, type='bool'),
scheme=dict(default='digest', choices=['digest', 'sasl']),
credential=dict(type='str')
),
supports_check_mode=False
)
Expand Down Expand Up @@ -201,6 +222,8 @@ def shutdown(self):

def start(self):
self.zk.start()
if (self.module.params['credential']):
self.zk.add_auth(self.module.params['scheme'], self.module.params['credential'])

def wait(self):
return self._wait(self.module.params['name'], self.module.params['timeout'])
Expand Down

0 comments on commit 4c143af

Please sign in to comment.