Add TLS certs params to redis (#8654)

* add tls params to redis

* add PR number

* add example

* move doc to redis fragment

* Update changelogs/fragments/8654-add-redis-tls-params.yml

Co-authored-by: Felix Fontein <felix@fontein.de>

* rm aliases and add version_added

---------

Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
Matthieu Bourgain 2024-07-23 18:01:37 +02:00 committed by GitHub
commit 52126b8fae
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 37 additions and 1 deletions

View file

@ -57,7 +57,9 @@ def redis_auth_argument_spec(tls_default=True):
validate_certs=dict(type='bool',
default=True
),
ca_certs=dict(type='str')
ca_certs=dict(type='str'),
client_cert_file=dict(type='str'),
client_key_file=dict(type='str'),
)
@ -71,6 +73,8 @@ def redis_auth_params(module):
ca_certs = module.params['ca_certs']
if tls and ca_certs is None:
ca_certs = str(certifi.where())
client_cert_file = module.params['client_cert_file']
client_key_file = module.params['client_key_file']
if tuple(map(int, redis_version.split('.'))) < (3, 4, 0) and login_user is not None:
module.fail_json(
msg='The option `username` in only supported with redis >= 3.4.0.')
@ -78,6 +82,8 @@ def redis_auth_params(module):
'port': login_port,
'password': login_password,
'ssl_ca_certs': ca_certs,
'ssl_certfile': client_cert_file,
'ssl_keyfile': client_key_file,
'ssl_cert_reqs': validate_certs,
'ssl': tls}
if login_user is not None: