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

feat(redis_info): add option to fetch cluster info #8464

Merged
merged 4 commits into from
Jun 12, 2024
Merged
Changes from 1 commit
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
Prev Previous commit
Apply suggestions from code review
Co-authored-by: Felix Fontein <felix@fontein.de>
  • Loading branch information
tyxieblub and felixfontein authored Jun 10, 2024
commit 3f0b987c33971a368eccc143150d10d29dd819be
12 changes: 7 additions & 5 deletions plugins/modules/redis_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,8 @@
}
cluster:
description: The default set of cluster information sections U(https://redis.io/commands/cluster-info).
returned: success
returned: success if O(cluster=true)
version_added: 9.1.0
type: dict
sample: {
"cluster_state": ok,
Expand Down Expand Up @@ -235,7 +236,7 @@ def redis_client(**client_params):
# Module execution.
def main():
module_args = dict(
cluster=dict(type='bool', default=False)
cluster=dict(type='bool', default=False),
)
module_args.update(redis_auth_argument_spec(tls_default=False))
module = AnsibleModule(
Expand All @@ -257,11 +258,12 @@ def main():

info = client.info()

cluster_info = dict()
result = dict(changed=False, info=info)

if cluster:
cluster_info = client.execute_command('CLUSTER INFO')
result['cluster_info'] = client.execute_command('CLUSTER INFO')

module.exit_json(changed=False, info=info, cluster_info=cluster_info)
module.exit_json(**result)


if __name__ == '__main__':
Expand Down