redis: binding is possible on multiple interfaces

This commit is contained in:
Jérémy Lecour 2022-06-08 15:36:47 +02:00 committed by Jérémy Lecour
parent 1895c549d4
commit b677defd97
6 changed files with 15 additions and 4 deletions

View file

@ -14,6 +14,8 @@ The **patch** part changes is incremented if multiple releases happen the same m
### Changed
* redis: binding is possible on multiple interfaces (breaking change)
### Fixed
### Removed

View file

@ -14,7 +14,7 @@ Main variables are :
* `redis_conf_dir`: config directory ;
* `redis_port`: listening TCP port ;
* `redis_bind_interface`: listening IP address ;
* `redis_bind_interfaces`: listening IP addresses (array) ;
* `redis_password`: password for redis. Empty means no password ;
* `redis_socket_dir`: Unix socket directory ;
* `redis_log_level`: log verbosity ;

View file

@ -6,7 +6,8 @@ redis_conf_dir_prefix: /etc/redis
redis_force_instance_port: False
redis_port: 6379
redis_bind_interface: 127.0.0.1
redis_bind_interfaces:
- 127.0.0.1
redis_socket_enabled: True
redis_socket_dir_prefix: '/run/redis'

View file

@ -63,6 +63,14 @@
redis_data_dir: "{{ redis_data_dir_prefix }}-{{ redis_instance_name }}"
when: redis_instance_name is defined
- name: Fail if redis_bind_interface is set
fail:
msg: "Please change 'redis_bind_interface' (String) to 'redis_bind_interfaces' (List)"
when:
- redis_bind_interface is defined
- redis_bind_interface is not none
- redis_bind_interface | length > 0
- name: configure Redis for default mode
include: default-server.yml
when: redis_instance_name is not defined

View file

@ -60,7 +60,7 @@
replace:
dest: /etc/nagios/nrpe.d/evolix.cfg
regexp: '^command\[check_redis\]=.+'
replace: 'command[check_redis]=sudo {{ redis_check_redis_path }} -H {{ redis_bind_interface }} -p {{ redis_port }}'
replace: 'command[check_redis]=sudo {{ redis_check_redis_path }} -H {{ redis_bind_interfaces | first }} -p {{ redis_port }}'
when: redis_instance_name is undefined
notify: restart nagios-nrpe-server
tags:

View file

@ -1,7 +1,7 @@
daemonize yes
pidfile {{ redis_pid_dir }}/redis-server.pid
port {{ redis_port }}
bind {{ redis_bind_interface }}
bind {{ redis_bind_interfaces | join(' ') }}
{% if redis_socket_enabled %}
unixsocket {{ redis_socket_dir }}/redis.sock