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

Add support for Redis / Redict / Valkey socket authentication #9643

Open
1 task done
chriscroome opened this issue Jan 27, 2025 · 2 comments
Open
1 task done

Add support for Redis / Redict / Valkey socket authentication #9643

chriscroome opened this issue Jan 27, 2025 · 2 comments
Labels
feature This issue/PR relates to a feature request module module plugins plugin (any type)

Comments

@chriscroome
Copy link

chriscroome commented Jan 27, 2025

Summary

Currently the community.general.redis_info module only support TCP/IP, if /etc/redis/redis.conf is edited to change the port and unixsocket lines:

# Accept connections on the specified port, default is 6379 (IANA #815344).
# If port 0 is specified Redis will not listen on a TCP socket.
# port 6379
port 0

# Unix socket.
#
# Specify the path for the Unix socket that will be used to listen for
# incoming connections. There is no default, so Redis will not listen
# on a unix socket when not specified.
#
# unixsocket /run/redis/redis-server.sock
unixsocket /run/redis/redis-server.sock
# unixsocketperm 700

Then the module fails with:

unable to connect to database: Error 111 connecting to localhost:6379. Connection refused.

I'd like to suggest adding a login_socket or some such variable to the module.

Issue Type

Feature Idea

Component Name

redis

Additional Information

If the port is set to 0 the module still tries to connect using TCP/IP, for example:

- name: Get server information
  community.general.redis_info:
    login_port: 0

Returns:

unable to connect to database: Error 111 connecting to localhost:0. Connection refused.

If the host is set to a socket path, as is the case for some client configuration, for example Nextcloud for example:

- name: Get server information
  community.general.redis_info:
    login_host: /run/valkey/valkey-server.sock
    login_port: 0

Returns:

unable to connect to database: Error -2 connecting to /run/valkey/valkey-server.sock:0.
Name or service not known.

And if the port is not specified the default is used, for example:

- name: Get server information
  community.general.redis_info:
    login_host: /run/valkey/valkey-server.sock

Returns:

unable to connect to database: Error -2 connecting to /run/valkey/valkey-server.sock:6379.
Name or service not known.

Note I actually tested this with Valkey from Debian Bookworm Backports but I'm fairly confident that the same result would be returned with Redis.

Code of Conduct

  • I agree to follow the Ansible Code of Conduct
@ansibullbot
Copy link
Collaborator

Files identified in the description:

If these files are incorrect, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibullbot
Copy link
Collaborator

cc @slok
click here for bot help

@ansibullbot ansibullbot added feature This issue/PR relates to a feature request module module plugins plugin (any type) labels Jan 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature This issue/PR relates to a feature request module module plugins plugin (any type)
Projects
None yet
Development

No branches or pull requests

2 participants