From 67caa5ba8b5e81d3879d3e3fb88fd12b7ea35afb Mon Sep 17 00:00:00 2001 From: ace Date: Tue, 23 Nov 2021 14:18:08 +0300 Subject: [PATCH] add redis_force_configure option and use template instead blockinfile for redis-auth.conf --- defaults/main.yaml | 1 + tasks/configure.yaml | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/defaults/main.yaml b/defaults/main.yaml index d8ade88..7789cec 100644 --- a/defaults/main.yaml +++ b/defaults/main.yaml @@ -6,6 +6,7 @@ redis_requirepass: P@ssw0rd redis_masterauth: P@ssw0rd redis_masteruser: masteruser redis_mastername: mymaster +redis_force_configure: false redis_debian_apt_key: - name: redis.io.gpg diff --git a/tasks/configure.yaml b/tasks/configure.yaml index f4fb125..141ad88 100644 --- a/tasks/configure.yaml +++ b/tasks/configure.yaml @@ -23,7 +23,7 @@ notify: - Restart redis - when: service_redis_status.rc != 0 + when: service_redis_status.rc != 0 or redis_force_configure - name: Ensure redis auth config exists copy: @@ -35,8 +35,8 @@ mode: 0640 - name: Template redis auth config - blockinfile: - block: "{{ lookup('template', '{{ ansible_os_family }}/etc/redis/redis-auth.conf.j2') }}" - path: "/etc/redis/redis-auth.conf" + template: + src: "{{ ansible_os_family }}/etc/redis/redis-auth.conf.j2" + dest: "/etc/redis/redis-auth.conf" notify: - Restart redis