forked from evolix/ansible-roles
redis: manage config template inside a block
This allows to have a coherent block managed by Ansible and extra lines that won't be overwritten. Eg. : automatically added lines for replication, sentinel groups…
This commit is contained in:
parent
f994e19946
commit
51280c586a
|
@ -51,6 +51,7 @@ The **patch** part changes is incremented if multiple releases happen the same m
|
||||||
* nagios: cleaning nrpe check template
|
* nagios: cleaning nrpe check template
|
||||||
* nagios: rename var `nagios_nrpe_process_processes` into `nagios_nrpe_processes` and check systemd-timesyncd instead of ntpd in Debian 12
|
* nagios: rename var `nagios_nrpe_process_processes` into `nagios_nrpe_processes` and check systemd-timesyncd instead of ntpd in Debian 12
|
||||||
* proftpd: in SFTP vhost, enable SSH keys login, enable ed25549 host key for Debian >= 11
|
* proftpd: in SFTP vhost, enable SSH keys login, enable ed25549 host key for Debian >= 11
|
||||||
|
* redis: manage config template inside a block, to allow custom modifications outside
|
||||||
* squid: config directory seems to have changed from /etc/squid3 to /etc/squid in Debian 8
|
* squid: config directory seems to have changed from /etc/squid3 to /etc/squid in Debian 8
|
||||||
* spamassassin: Use spamd starting with Bookworm
|
* spamassassin: Use spamd starting with Bookworm
|
||||||
* unbound: Add config file to allow configuration reload on Debian 11 and lower
|
* unbound: Add config file to allow configuration reload on Debian 11 and lower
|
||||||
|
|
|
@ -3,6 +3,8 @@ redis_systemd_name: redis-server
|
||||||
|
|
||||||
redis_conf_dir_prefix: /etc/redis
|
redis_conf_dir_prefix: /etc/redis
|
||||||
|
|
||||||
|
redis_conf_marker_label: "ANSIBLE MANAGED CONFIGURATION"
|
||||||
|
|
||||||
redis_force_instance_port: False
|
redis_force_instance_port: False
|
||||||
|
|
||||||
redis_port: 6379
|
redis_port: 6379
|
||||||
|
|
|
@ -1,12 +1,32 @@
|
||||||
---
|
---
|
||||||
|
|
||||||
- name: Redis is configured.
|
- name: "Add begin marker if missing"
|
||||||
ansible.builtin.template:
|
ansible.builtin.lineinfile:
|
||||||
src: redis.conf.j2
|
path: "{{ redis_conf_dir }}/redis.conf"
|
||||||
dest: "{{ redis_conf_dir }}/redis.conf"
|
line: "# BEGIN {{ redis_conf_marker_label }}"
|
||||||
|
insertbefore: BOF
|
||||||
|
create: yes
|
||||||
|
tags:
|
||||||
|
- redis
|
||||||
|
|
||||||
|
- name: "Add end marker if missing"
|
||||||
|
ansible.builtin.lineinfile:
|
||||||
|
path: "{{ redis_conf_dir }}/redis.conf"
|
||||||
|
line: "# END {{ redis_conf_marker_label }}"
|
||||||
|
insertbefore: "Generated by CONFIG REWRITE"
|
||||||
|
create: yes
|
||||||
|
tags:
|
||||||
|
- redis
|
||||||
|
|
||||||
|
- name: "Create config if missing"
|
||||||
|
ansible.builtin.blockinfile:
|
||||||
|
path: "{{ redis_conf_dir }}/redis.conf"
|
||||||
|
marker: "# {mark} {{ redis_conf_marker_label }}"
|
||||||
|
block: "{{ lookup('ansible.builtin.template', '../templates/redis.conf.j2') }}"
|
||||||
mode: "0640"
|
mode: "0640"
|
||||||
owner: redis
|
owner: redis
|
||||||
group: redis
|
group: redis
|
||||||
|
create: yes
|
||||||
notify: "{{ redis_restart_handler_name }}"
|
notify: "{{ redis_restart_handler_name }}"
|
||||||
tags:
|
tags:
|
||||||
- redis
|
- redis
|
||||||
|
|
|
@ -118,14 +118,33 @@
|
||||||
tags:
|
tags:
|
||||||
- redis
|
- redis
|
||||||
|
|
||||||
|
- name: "Add begin marker if missing"
|
||||||
|
ansible.builtin.lineinfile:
|
||||||
|
path: "{{ redis_conf_dir }}/redis.conf"
|
||||||
|
line: "# BEGIN {{ redis_conf_marker_label }}"
|
||||||
|
insertbefore: BOF
|
||||||
|
create: yes
|
||||||
|
tags:
|
||||||
|
- redis
|
||||||
|
|
||||||
- name: "Instance '{{ redis_instance_name }}' configuration file is present"
|
- name: "Add end marker if missing"
|
||||||
ansible.builtin.template:
|
ansible.builtin.lineinfile:
|
||||||
src: redis.conf.j2
|
path: "{{ redis_conf_dir }}/redis.conf"
|
||||||
dest: "{{ redis_conf_dir }}/redis.conf"
|
line: "# END {{ redis_conf_marker_label }}"
|
||||||
|
insertbefore: "# Generated by CONFIG REWRITE"
|
||||||
|
create: yes
|
||||||
|
tags:
|
||||||
|
- redis
|
||||||
|
|
||||||
|
- name: "Create config if missing"
|
||||||
|
ansible.builtin.blockinfile:
|
||||||
|
path: "{{ redis_conf_dir }}/redis.conf"
|
||||||
|
marker: "# {mark} {{ redis_conf_marker_label }}"
|
||||||
|
block: "{{ lookup('ansible.builtin.template', '../templates/redis.conf.j2') }}"
|
||||||
mode: "0640"
|
mode: "0640"
|
||||||
owner: redis-{{ redis_instance_name }}
|
owner: redis-{{ redis_instance_name }}
|
||||||
group: redis-{{ redis_instance_name }}
|
group: redis-{{ redis_instance_name }}
|
||||||
|
create: yes
|
||||||
notify: "{{ redis_restart_handler_name }}"
|
notify: "{{ redis_restart_handler_name }}"
|
||||||
tags:
|
tags:
|
||||||
- redis
|
- redis
|
||||||
|
|
Loading…
Reference in a new issue