add redis_force_configure option and use template instead blockinfile for redis-auth.conf

This commit is contained in:
ace 2021-11-23 14:18:08 +03:00
parent 549afbf95e
commit 67caa5ba8b
No known key found for this signature in database
GPG Key ID: E805F7888C3ED7C0
2 changed files with 5 additions and 4 deletions

View File

@ -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

View File

@ -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