mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
znode: add options for authentication (#5306)
* add options for authentication * Update changelogs/fragments/5306-add-options-for-authentication.yml Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/clustering/znode.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/clustering/znode.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/clustering/znode.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/clustering/znode.py Co-authored-by: Felix Fontein <felix@fontein.de> * rename scheme to auth_scheme, credential to auth_credential * make pycodestyle happy * Update plugins/modules/clustering/znode.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/clustering/znode.py Co-authored-by: Felix Fontein <felix@fontein.de> * remove unneeded quotes * Update changelogs/fragments/5306-add-options-for-authentication.yml Co-authored-by: Felix Fontein <felix@fontein.de> * Update version_added. Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
parent
7b86fa6a7d
commit
96b6ef5765
2 changed files with 30 additions and 1 deletions
|
@ -0,0 +1,2 @@
|
||||||
|
minor_changes:
|
||||||
|
- znode - possibility to use ZooKeeper ACL authentication (https://github.com/ansible-collections/community.general/pull/5306).
|
|
@ -49,6 +49,22 @@ options:
|
||||||
- Recursively delete node and all its children.
|
- Recursively delete node and all its children.
|
||||||
type: bool
|
type: bool
|
||||||
default: false
|
default: false
|
||||||
|
auth_scheme:
|
||||||
|
description:
|
||||||
|
- 'Authentication scheme.'
|
||||||
|
choices: [ digest, sasl ]
|
||||||
|
type: str
|
||||||
|
default: "digest"
|
||||||
|
required: false
|
||||||
|
version_added: 5.8.0
|
||||||
|
auth_credential:
|
||||||
|
description:
|
||||||
|
- The authentication credential value. Depends on I(auth_scheme).
|
||||||
|
- The format for I(auth_scheme=digest) is C(user:password),
|
||||||
|
and the format for I(auth_scheme=sasl) is C(user:password).
|
||||||
|
type: str
|
||||||
|
required: false
|
||||||
|
version_added: 5.8.0
|
||||||
requirements:
|
requirements:
|
||||||
- kazoo >= 2.1
|
- kazoo >= 2.1
|
||||||
- python >= 2.6
|
- python >= 2.6
|
||||||
|
@ -69,6 +85,13 @@ EXAMPLES = """
|
||||||
name: /mypath
|
name: /mypath
|
||||||
op: get
|
op: get
|
||||||
|
|
||||||
|
- name: Getting the value and stat structure for a znode using digest authentication
|
||||||
|
community.general.znode:
|
||||||
|
hosts: 'localhost:2181'
|
||||||
|
auth_credential: 'user1:s3cr3t'
|
||||||
|
name: /secretmypath
|
||||||
|
op: get
|
||||||
|
|
||||||
- name: Listing a particular znode's children
|
- name: Listing a particular znode's children
|
||||||
community.general.znode:
|
community.general.znode:
|
||||||
hosts: 'localhost:2181'
|
hosts: 'localhost:2181'
|
||||||
|
@ -122,7 +145,9 @@ def main():
|
||||||
op=dict(choices=['get', 'wait', 'list']),
|
op=dict(choices=['get', 'wait', 'list']),
|
||||||
state=dict(choices=['present', 'absent']),
|
state=dict(choices=['present', 'absent']),
|
||||||
timeout=dict(default=300, type='int'),
|
timeout=dict(default=300, type='int'),
|
||||||
recursive=dict(default=False, type='bool')
|
recursive=dict(default=False, type='bool'),
|
||||||
|
auth_scheme=dict(default='digest', choices=['digest', 'sasl']),
|
||||||
|
auth_credential=dict(type='str', no_log=True),
|
||||||
),
|
),
|
||||||
supports_check_mode=False
|
supports_check_mode=False
|
||||||
)
|
)
|
||||||
|
@ -201,6 +226,8 @@ class KazooCommandProxy():
|
||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
self.zk.start()
|
self.zk.start()
|
||||||
|
if self.module.params['auth_credential']:
|
||||||
|
self.zk.add_auth(self.module.params['auth_scheme'], self.module.params['auth_credential'])
|
||||||
|
|
||||||
def wait(self):
|
def wait(self):
|
||||||
return self._wait(self.module.params['name'], self.module.params['timeout'])
|
return self._wait(self.module.params['name'], self.module.params['timeout'])
|
||||||
|
|
Loading…
Reference in a new issue