From 4f5b17353101283637d713ecb9cc5c5b32fe3d45 Mon Sep 17 00:00:00 2001 From: opan Date: Fri, 25 Jun 2021 10:14:06 +0700 Subject: [PATCH 01/18] Add support redis cluster Co-authored-by: William Dembo <1708-william.dembo@users.noreply.source.golabs.io> --- defaults/main.yml | 4 ++++ templates/redis.conf.j2 | 9 ++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/defaults/main.yml b/defaults/main.yml index dfc8956d..5cf29315 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -118,6 +118,10 @@ redis_hz: 10 # io-threads-do-reads yes redis_config_additional: "" +## Redis cluster configs +redis_cluster_enabled: false +redis_cluster_node_timeout: 15000 + ## Redis sentinel configs # Set this to true on a host to configure it as a Sentinel redis_sentinel: false diff --git a/templates/redis.conf.j2 b/templates/redis.conf.j2 index 04e24a4f..e5326df4 100644 --- a/templates/redis.conf.j2 +++ b/templates/redis.conf.j2 @@ -53,6 +53,13 @@ min-slaves-max-lag {{ redis_min_slaves_max_lag }} masterauth {{ redis_password }} {% endif -%} +{% if redis_cluster_enabled %} +# Cluster +cluster-enabled yes +cluster-config-file nodes-{{ redis_port }}.conf +cluster-node-timeout {{ redis_cluster_node_timeout }} +{% endif -%} + # Security {% if redis_password -%} requirepass {{ redis_password }} @@ -104,4 +111,4 @@ aof-rewrite-incremental-fsync yes {% if redis_config_additional|length -%} # Additional {{ redis_config_additional -}} -{% endif -%} \ No newline at end of file +{% endif -%} From f1367a3fb394cf16efe85014a489c773e3bd05ec Mon Sep 17 00:00:00 2001 From: Imre Nagi Date: Mon, 11 Apr 2022 11:45:26 +0700 Subject: [PATCH 02/18] fix: remove redis restart command after changing the config Signed-off-by: Imre Nagi Co-authored-by: William Dembo <29192168+walbertus@users.noreply.github.com> --- defaults/main.yml | 2 +- tasks/server.yml | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index 5cf29315..efea5b6c 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -5,7 +5,7 @@ redis_install_dir: /opt/redis redis_install_from_source: true redis_dir: /var/lib/redis/{{ redis_port }} redis_config_file_name: "{{ redis_port }}.conf" -redis_download_url: "http://download.redis.io/releases/redis-{{ redis_version }}.tar.gz" +redis_download_url: "https://download.redis.io/releases/redis-{{ redis_version }}.tar.gz" redis_protected_mode: "yes" # Set this to true to validate redis tarball checksum against vars/main.yml diff --git a/tasks/server.yml b/tasks/server.yml index 1243c748..0ef99a50 100644 --- a/tasks/server.yml +++ b/tasks/server.yml @@ -118,7 +118,6 @@ dest: /etc/redis/{{ redis_config_file_name }} owner: "{{ redis_user }}" mode: 0640 - notify: "restart redis" - name: add redis init config file template: @@ -126,7 +125,6 @@ src: redis.init.conf.j2 mode: 0600 when: ansible_os_family == "RedHat" - notify: "restart redis" - name: add redis init config file template: @@ -134,7 +132,6 @@ src: redis.init.conf.j2 mode: 0600 when: ansible_os_family == "Debian" - notify: "restart redis" # Flush handlers before ensuring the service is started to prevent # a start and then restart From a8f78aaa7bea4cfb1c53e798e1ec895e4aad4d15 Mon Sep 17 00:00:00 2001 From: Imre Nagi Date: Mon, 18 Apr 2022 14:36:52 +0700 Subject: [PATCH 03/18] Add notify restart Signed-off-by: Imre Nagi Co-authored-by: William Dembo <1708-william.dembo@users.noreply.source.golabs.io> --- tasks/server.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tasks/server.yml b/tasks/server.yml index 0ef99a50..1243c748 100644 --- a/tasks/server.yml +++ b/tasks/server.yml @@ -118,6 +118,7 @@ dest: /etc/redis/{{ redis_config_file_name }} owner: "{{ redis_user }}" mode: 0640 + notify: "restart redis" - name: add redis init config file template: @@ -125,6 +126,7 @@ src: redis.init.conf.j2 mode: 0600 when: ansible_os_family == "RedHat" + notify: "restart redis" - name: add redis init config file template: @@ -132,6 +134,7 @@ src: redis.init.conf.j2 mode: 0600 when: ansible_os_family == "Debian" + notify: "restart redis" # Flush handlers before ensuring the service is started to prevent # a start and then restart From ad3b2ec17d17a0909b42e9de0d8b0218fe1a834c Mon Sep 17 00:00:00 2001 From: opanmustopah Date: Wed, 15 Jun 2022 12:28:58 +0700 Subject: [PATCH 04/18] feat: add config to control slave promotion Add config to control whehter a slave can be promoted as a master or not --- defaults/main.yml | 3 +++ templates/redis.conf.j2 | 3 +++ 2 files changed, 6 insertions(+) diff --git a/defaults/main.yml b/defaults/main.yml index efea5b6c..b14b1dd7 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -121,6 +121,9 @@ redis_config_additional: "" ## Redis cluster configs redis_cluster_enabled: false redis_cluster_node_timeout: 15000 +# Prevent slave to be promoted as a master in case of auto-failover +# only works in version 4.x and above +redis_cluster_slave_no_failover: "no" ## Redis sentinel configs # Set this to true on a host to configure it as a Sentinel diff --git a/templates/redis.conf.j2 b/templates/redis.conf.j2 index e5326df4..8529d05b 100644 --- a/templates/redis.conf.j2 +++ b/templates/redis.conf.j2 @@ -58,6 +58,9 @@ masterauth {{ redis_password }} cluster-enabled yes cluster-config-file nodes-{{ redis_port }}.conf cluster-node-timeout {{ redis_cluster_node_timeout }} +{% if redis_version | split('.') | first | int >= 4 %} +cluster-slave-no-failover {{ redis_cluster_slave_no_failover }} +{% end %} {% endif -%} # Security From 3d7fe9e480c85edde6a2bdc1f4995c08913cc5ab Mon Sep 17 00:00:00 2001 From: opanmustopah Date: Wed, 15 Jun 2022 14:58:53 +0700 Subject: [PATCH 05/18] fix: wrong closing if syntax --- templates/redis.conf.j2 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/redis.conf.j2 b/templates/redis.conf.j2 index 8529d05b..96cecdd9 100644 --- a/templates/redis.conf.j2 +++ b/templates/redis.conf.j2 @@ -58,9 +58,9 @@ masterauth {{ redis_password }} cluster-enabled yes cluster-config-file nodes-{{ redis_port }}.conf cluster-node-timeout {{ redis_cluster_node_timeout }} -{% if redis_version | split('.') | first | int >= 4 %} +{% if redis_version | split('.') | first | int >= 4 -%} cluster-slave-no-failover {{ redis_cluster_slave_no_failover }} -{% end %} +{% endif -%} {% endif -%} # Security From 1548e2e0f6bd25c6c832b9b03ea17e80ba560c25 Mon Sep 17 00:00:00 2001 From: opanmustopah Date: Wed, 15 Jun 2022 15:33:31 +0700 Subject: [PATCH 06/18] fix: split syntax --- templates/redis.conf.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/redis.conf.j2 b/templates/redis.conf.j2 index 96cecdd9..c709e30c 100644 --- a/templates/redis.conf.j2 +++ b/templates/redis.conf.j2 @@ -58,7 +58,7 @@ masterauth {{ redis_password }} cluster-enabled yes cluster-config-file nodes-{{ redis_port }}.conf cluster-node-timeout {{ redis_cluster_node_timeout }} -{% if redis_version | split('.') | first | int >= 4 -%} +{% if redis_version.split('.') | first | int >= 4 -%} cluster-slave-no-failover {{ redis_cluster_slave_no_failover }} {% endif -%} {% endif -%} From 9613a6226f03bd0c583dc70d7e2c0904cd1c27f7 Mon Sep 17 00:00:00 2001 From: opanmustopah Date: Mon, 29 Aug 2022 16:17:11 +0700 Subject: [PATCH 07/18] fix: update protected_mode to no set sentinels nodes option to empty by default --- defaults/main.yml | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index b14b1dd7..2fcfbc94 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -128,7 +128,7 @@ redis_cluster_slave_no_failover: "no" ## Redis sentinel configs # Set this to true on a host to configure it as a Sentinel redis_sentinel: false -redis_sentinel_protected_mode: "yes" +redis_sentinel_protected_mode: "no" redis_sentinel_dir: /var/lib/redis/sentinel_{{ redis_sentinel_port }} redis_sentinel_bind: 0.0.0.0 redis_sentinel_port: 26379 @@ -137,15 +137,17 @@ redis_sentinel_pidfile: /var/run/redis/sentinel_{{ redis_sentinel_port }}.pid redis_sentinel_logfile: '""' redis_sentinel_syslog_ident: sentinel_{{ redis_sentinel_port }} redis_sentinel_oom_score_adjust: 0 -redis_sentinel_monitors: - - name: master01 - host: localhost - port: 6379 - quorum: 2 - auth_pass: ant1r3z - down_after_milliseconds: 30000 - parallel_syncs: 1 - failover_timeout: 180000 - notification_script: false - client_reconfig_script: false - rename_commands: [] +redis_sentinel_monitors: [] +# Example: +# redis_sentinel_monitors: +# - name: master01 +# host: localhost +# port: 6379 +# quorum: 2 +# auth_pass: ant1r3z +# down_after_milliseconds: 30000 +# parallel_syncs: 1 +# failover_timeout: 180000 +# notification_script: false +# client_reconfig_script: false +# rename_commands: [] From d34c50587a40dcbe681c9b339b9e2a92a28b3b8b Mon Sep 17 00:00:00 2001 From: opanmustopah Date: Mon, 17 Oct 2022 16:16:59 +0700 Subject: [PATCH 08/18] feat: add redis_sentinel_static_monitor_master set to false if master is registered via command instead updating from config file --- defaults/main.yml | 3 +++ templates/redis_sentinel.conf.j2 | 2 ++ 2 files changed, 5 insertions(+) diff --git a/defaults/main.yml b/defaults/main.yml index 2fcfbc94..c4658bb9 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -138,6 +138,9 @@ redis_sentinel_logfile: '""' redis_sentinel_syslog_ident: sentinel_{{ redis_sentinel_port }} redis_sentinel_oom_score_adjust: 0 redis_sentinel_monitors: [] +# Set this to false if you monitor master via command instead hardcoded +# in the config file +redis_sentinel_static_monitor_master: true # Example: # redis_sentinel_monitors: # - name: master01 diff --git a/templates/redis_sentinel.conf.j2 b/templates/redis_sentinel.conf.j2 index 2fc59390..830fb5b9 100644 --- a/templates/redis_sentinel.conf.j2 +++ b/templates/redis_sentinel.conf.j2 @@ -13,6 +13,7 @@ bind {{ redis_sentinel_bind }} requirepass {{ redis_sentinel_password }} {% endif %} +{% if redis_sentinel_static_monitor_master %} {% for master in redis_sentinel_monitors -%} sentinel monitor {{ master.name }} {{ master.host }} {{ master.port }} {{ master.quorum|d('2') }} {% for option in ('auth_pass', 'down_after_milliseconds', 'parallel_syncs', 'failover_timeout', 'notification_script', 'client_reconfig_script') -%} @@ -26,6 +27,7 @@ sentinel rename-command {{ master.name }} {{ command }} {% endfor -%} {% endif -%} {% endfor -%} +{% endif %} logfile {{ redis_sentinel_logfile }} syslog-enabled {{ redis_syslog_enabled }} From dbddb2d8aa2b362f545c8b05dc12338114836ee5 Mon Sep 17 00:00:00 2001 From: opanmustopah Date: Tue, 18 Oct 2022 13:38:53 +0700 Subject: [PATCH 09/18] fix: allow to partially update sentinel config --- defaults/main.yml | 6 +-- tasks/sentinel.yml | 64 ++++++++++++++++++++++++++++++++ templates/redis_sentinel.conf.j2 | 5 ++- 3 files changed, 70 insertions(+), 5 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index c4658bb9..9b5882e7 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -138,9 +138,9 @@ redis_sentinel_logfile: '""' redis_sentinel_syslog_ident: sentinel_{{ redis_sentinel_port }} redis_sentinel_oom_score_adjust: 0 redis_sentinel_monitors: [] -# Set this to false if you monitor master via command instead hardcoded -# in the config file -redis_sentinel_static_monitor_master: true +# Set this to true if you update the configuration via runtime +# e.g: registering master to monitor via command-line instead manually edit the config file +redis_sentinel_runtime_monitor_master: false # Example: # redis_sentinel_monitors: # - name: master01 diff --git a/tasks/sentinel.yml b/tasks/sentinel.yml index 90e11b93..3737ceeb 100644 --- a/tasks/sentinel.yml +++ b/tasks/sentinel.yml @@ -103,6 +103,26 @@ - redis_sentinel_pidfile != '""' - not sentinel_piddir.stat.exists +- name: check if sentinel is running + command: + cmd: systemctl status sentinel_{{ redis_sentinel_port }} + ignore_errors: true + changed_when: false + register: sentinel_service_status + +- name: run flushconfig to rewrite config file from current configuration + command: + cmd: "redis-cli -p {{ redis_sentinel_port }} SENTINEL FLUSHCONFIG" + when: sentinel_service_status | success + +- name: backup existing config file + copy: + src: /etc/redis/sentinel_{{ redis_sentinel_port }}.conf + dest: /etc/redis/sentinel_{{ redis_sentinel_port }}.conf.{{ ansible_date_time['date'] }} + owner: "{{ redis_user }}" + mode: 0640 + backup: yes + - name: create sentinel config file template: src: redis_sentinel.conf.j2 @@ -110,6 +130,50 @@ owner: "{{ redis_user }}" mode: 0640 notify: "restart sentinel" + when: not redis_sentinel_runtime_monitor_master + +- name: update static configuration in config file + blockinfile: + path: /etc/redis/sentinel_{{ redis_sentinel_port }}.conf + insertafter: "### STATIC CONFIG START HERE ###" + insertbefore: "### STATIC CONFIG STOP HERE ###" + owner: "{{ redis_user }}" + mode: 0640 + when: redis_sentinel_runtime_monitor_master == true + block: | + # redis-sentinel {{ redis_version }} configuration file + # sentinel_{{ redis_sentinel_port }}.conf + + daemonize {{ redis_daemonize }} + protected-mode {{ redis_sentinel_protected_mode }} + dir {{ redis_sentinel_dir }} + pidfile {{ redis_sentinel_pidfile }} + port {{ redis_sentinel_port }} + bind {{ redis_sentinel_bind }} + + # Security + {% if redis_sentinel_password %} + requirepass {{ redis_sentinel_password }} + {% endif %} + + {% for master in redis_sentinel_monitors -%} + sentinel monitor {{ master.name }} {{ master.host }} {{ master.port }} {{ master.quorum|d('2') }} + {% for option in ('auth_pass', 'down_after_milliseconds', 'parallel_syncs', 'failover_timeout', 'notification_script', 'client_reconfig_script') -%} + {% if master[option] is defined and master[option] -%} + sentinel {{ option|replace('_', '-') }} {{ master.name }} {{ master[option] }} + {% endif %} + {% endfor -%} + {% if master['rename_commands'] is defined -%} + {% for command in master['rename_commands'] -%} + sentinel rename-command {{ master.name }} {{ command }} + {% endfor -%} + {% endif -%} + {% endfor -%} + + logfile {{ redis_sentinel_logfile }} + syslog-enabled {{ redis_syslog_enabled }} + syslog-ident {{ redis_sentinel_syslog_ident }} + syslog-facility {{ redis_syslog_facility }} - name: add sentinel init config file template: diff --git a/templates/redis_sentinel.conf.j2 b/templates/redis_sentinel.conf.j2 index 830fb5b9..919ddb34 100644 --- a/templates/redis_sentinel.conf.j2 +++ b/templates/redis_sentinel.conf.j2 @@ -1,3 +1,4 @@ +### STATIC CONFIG START HERE ### # redis-sentinel {{ redis_version }} configuration file # sentinel_{{ redis_sentinel_port }}.conf @@ -13,7 +14,6 @@ bind {{ redis_sentinel_bind }} requirepass {{ redis_sentinel_password }} {% endif %} -{% if redis_sentinel_static_monitor_master %} {% for master in redis_sentinel_monitors -%} sentinel monitor {{ master.name }} {{ master.host }} {{ master.port }} {{ master.quorum|d('2') }} {% for option in ('auth_pass', 'down_after_milliseconds', 'parallel_syncs', 'failover_timeout', 'notification_script', 'client_reconfig_script') -%} @@ -27,9 +27,10 @@ sentinel rename-command {{ master.name }} {{ command }} {% endfor -%} {% endif -%} {% endfor -%} -{% endif %} logfile {{ redis_sentinel_logfile }} syslog-enabled {{ redis_syslog_enabled }} syslog-ident {{ redis_sentinel_syslog_ident }} syslog-facility {{ redis_syslog_facility }} + +### STATIC CONFIG STOP HERE ### From c199e7e4bb93dbc69edf4f9ecd32fe369878c2a8 Mon Sep 17 00:00:00 2001 From: opanmustopah Date: Tue, 18 Oct 2022 13:46:52 +0700 Subject: [PATCH 10/18] fix: update checking service sentinel running before flushconfig --- tasks/sentinel.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/sentinel.yml b/tasks/sentinel.yml index 3737ceeb..e9c8efcc 100644 --- a/tasks/sentinel.yml +++ b/tasks/sentinel.yml @@ -113,7 +113,7 @@ - name: run flushconfig to rewrite config file from current configuration command: cmd: "redis-cli -p {{ redis_sentinel_port }} SENTINEL FLUSHCONFIG" - when: sentinel_service_status | success + when: sentinel_service_status.rc == 0 - name: backup existing config file copy: From fdb6bcbf5859407888a63077f8a8a914fb691570 Mon Sep 17 00:00:00 2001 From: opanmustopah Date: Tue, 18 Oct 2022 13:52:12 +0700 Subject: [PATCH 11/18] fix: set remote_src true when copying file --- tasks/sentinel.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/tasks/sentinel.yml b/tasks/sentinel.yml index e9c8efcc..ff91a1c4 100644 --- a/tasks/sentinel.yml +++ b/tasks/sentinel.yml @@ -122,6 +122,7 @@ owner: "{{ redis_user }}" mode: 0640 backup: yes + remote_src: true - name: create sentinel config file template: From de4a6ec68b546303bf629eabef15d36fee21e787 Mon Sep 17 00:00:00 2001 From: opanmustopah Date: Tue, 18 Oct 2022 13:57:01 +0700 Subject: [PATCH 12/18] fix: wrong placement of when clause --- tasks/sentinel.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tasks/sentinel.yml b/tasks/sentinel.yml index ff91a1c4..f2b3d59f 100644 --- a/tasks/sentinel.yml +++ b/tasks/sentinel.yml @@ -140,7 +140,7 @@ insertbefore: "### STATIC CONFIG STOP HERE ###" owner: "{{ redis_user }}" mode: 0640 - when: redis_sentinel_runtime_monitor_master == true + backup: yes block: | # redis-sentinel {{ redis_version }} configuration file # sentinel_{{ redis_sentinel_port }}.conf @@ -175,6 +175,7 @@ syslog-enabled {{ redis_syslog_enabled }} syslog-ident {{ redis_sentinel_syslog_ident }} syslog-facility {{ redis_syslog_facility }} + when: redis_sentinel_runtime_monitor_master == true - name: add sentinel init config file template: From 6323ad0938af5a272b38c6e4b7b6fd07341657ea Mon Sep 17 00:00:00 2001 From: opanmustopah Date: Tue, 18 Oct 2022 14:12:32 +0700 Subject: [PATCH 13/18] fix: remove insertafter clause --- tasks/sentinel.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/tasks/sentinel.yml b/tasks/sentinel.yml index f2b3d59f..77f5c3d0 100644 --- a/tasks/sentinel.yml +++ b/tasks/sentinel.yml @@ -136,7 +136,6 @@ - name: update static configuration in config file blockinfile: path: /etc/redis/sentinel_{{ redis_sentinel_port }}.conf - insertafter: "### STATIC CONFIG START HERE ###" insertbefore: "### STATIC CONFIG STOP HERE ###" owner: "{{ redis_user }}" mode: 0640 From ee5a6d3b1581b1ad5f0bdf144b1e4c9a2a193876 Mon Sep 17 00:00:00 2001 From: opanmustopah Date: Tue, 18 Oct 2022 14:21:37 +0700 Subject: [PATCH 14/18] fix: remove unnecessary backup file --- tasks/sentinel.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/tasks/sentinel.yml b/tasks/sentinel.yml index 77f5c3d0..babd20ae 100644 --- a/tasks/sentinel.yml +++ b/tasks/sentinel.yml @@ -121,7 +121,6 @@ dest: /etc/redis/sentinel_{{ redis_sentinel_port }}.conf.{{ ansible_date_time['date'] }} owner: "{{ redis_user }}" mode: 0640 - backup: yes remote_src: true - name: create sentinel config file From fd927be297696086999234d52990813c4d835cc3 Mon Sep 17 00:00:00 2001 From: opanmustopah Date: Wed, 19 Oct 2022 09:43:08 +0700 Subject: [PATCH 15/18] fix: call notify restart sentinel when partially update sentinel config file --- tasks/sentinel.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/tasks/sentinel.yml b/tasks/sentinel.yml index babd20ae..f8e897ee 100644 --- a/tasks/sentinel.yml +++ b/tasks/sentinel.yml @@ -173,6 +173,7 @@ syslog-enabled {{ redis_syslog_enabled }} syslog-ident {{ redis_sentinel_syslog_ident }} syslog-facility {{ redis_syslog_facility }} + notify: "restart sentinel" when: redis_sentinel_runtime_monitor_master == true - name: add sentinel init config file From d391ba09e289cb74941d6e3426bf1854c69ecc0c Mon Sep 17 00:00:00 2001 From: opanmustopah Date: Mon, 24 Oct 2022 09:36:56 +0700 Subject: [PATCH 16/18] fix: check config file before backup sentinel config --- tasks/sentinel.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tasks/sentinel.yml b/tasks/sentinel.yml index f8e897ee..63a7218c 100644 --- a/tasks/sentinel.yml +++ b/tasks/sentinel.yml @@ -115,6 +115,11 @@ cmd: "redis-cli -p {{ redis_sentinel_port }} SENTINEL FLUSHCONFIG" when: sentinel_service_status.rc == 0 +- name: check if sentinel config file exists + stat: + path: /etc/redis/sentinel_{{ redis_sentinel_port }}.conf + register: _config_file + - name: backup existing config file copy: src: /etc/redis/sentinel_{{ redis_sentinel_port }}.conf @@ -122,6 +127,7 @@ owner: "{{ redis_user }}" mode: 0640 remote_src: true + when: _config_file.stat.exists - name: create sentinel config file template: @@ -130,7 +136,9 @@ owner: "{{ redis_user }}" mode: 0640 notify: "restart sentinel" - when: not redis_sentinel_runtime_monitor_master + when: + - not redis_sentinel_runtime_monitor_master or + not _config_file.stat.exists - name: update static configuration in config file blockinfile: From aee7ed49443747d0b06eb9107cf5ccfa60067c1c Mon Sep 17 00:00:00 2001 From: opan Date: Mon, 27 Mar 2023 16:39:50 +0700 Subject: [PATCH 17/18] fix: add maxclients and timeout config to sentinel.conf --- tasks/sentinel.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tasks/sentinel.yml b/tasks/sentinel.yml index 63a7218c..c7b58389 100644 --- a/tasks/sentinel.yml +++ b/tasks/sentinel.yml @@ -157,6 +157,8 @@ pidfile {{ redis_sentinel_pidfile }} port {{ redis_sentinel_port }} bind {{ redis_sentinel_bind }} + maxclients {{ redis_maxclients }} + timeout {{ redis_timeout }} # Security {% if redis_sentinel_password %} From d1825e2cb46738c4a788e5831b67ea92241eabc4 Mon Sep 17 00:00:00 2001 From: Rishav Sharma Date: Mon, 20 Nov 2023 15:21:12 +0530 Subject: [PATCH 18/18] fix: add patch for redis-5.0.5 --- tasks/dependencies.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tasks/dependencies.yml b/tasks/dependencies.yml index cbe2e429..636ce9fd 100644 --- a/tasks/dependencies.yml +++ b/tasks/dependencies.yml @@ -51,3 +51,10 @@ - "{{ 'libgcc_s1-32bit' if redis_make_32bit|bool else 'gcc' }}" state: present when: ansible_os_family == 'Suse' + +- name: "Add patch for redis-5.0.5 in Ubuntu 22.04" + ansible.builtin.lineinfile: + path: /usr/local/src/redis-5.0.5/src/sds.h + regexp: '^const char \*SDS_NOINIT;' + line: 'extern const char *SDS_NOINIT;' + when: redis_version == '5.0.5'