Browse Source

redis: set_facts separately to reuse them

log2mail-beats
Jérémy Lecour 10 months ago
parent
commit
099691614e
4 changed files with 28 additions and 15 deletions
  1. +3
    -0
      redis/defaults/main.yml
  2. +0
    -1
      redis/tasks/default-log2mail.yml
  3. +0
    -1
      redis/tasks/instance-log2mail.yml
  4. +25
    -13
      redis/tasks/main.yml

+ 3
- 0
redis/defaults/main.yml View File

@ -57,3 +57,6 @@ redis_disabled_commands: []
redis_sentinel_install: False
redis_default_server_disabled: False
general_alert_email: "root@localhost"
log2mail_alert_email: Null

+ 0
- 1
redis/tasks/default-log2mail.yml View File

@ -14,7 +14,6 @@
mailto = {{ log2mail_alert_email or general_alert_email | mandatory }}
template = /etc/log2mail/mail
notify: restart log2mail
when: log2mail_config_dir.stat.exists
tags:
- redis
- log2mail

+ 0
- 1
redis/tasks/instance-log2mail.yml View File

@ -14,7 +14,6 @@
mailto = {{ log2mail_alert_email or general_alert_email | mandatory }}
template = /etc/log2mail/mail
notify: restart log2mail
when: log2mail_config_dir.stat.exists
tags:
- redis
- log2mail

+ 25
- 13
redis/tasks/main.yml View File

@ -36,8 +36,17 @@
tags:
- redis
- include: instance-server.yml
vars:
- name: set variables for default mode
set_fact:
redis_conf_dir: "{{ redis_conf_dir_prefix }}"
redis_socket_dir: "{{ redis_socket_dir_prefix }}"
redis_pid_dir: "{{ redis_pid_dir_prefix }}"
redis_log_dir: "{{ redis_log_dir_prefix }}"
redis_data_dir: "{{ redis_data_dir_prefix }}"
when: redis_instance_name is not defined
- name: set variables for instance mode
set_fact:
redis_systemd_name: "redis-server@{{ redis_instance_name }}"
redis_conf_dir: "{{ redis_conf_dir_prefix }}-{{ redis_instance_name }}"
redis_socket_dir: "{{ redis_socket_dir_prefix }}-{{ redis_instance_name }}"
@ -46,15 +55,14 @@
redis_data_dir: "{{ redis_data_dir_prefix }}-{{ redis_instance_name }}"
when: redis_instance_name is defined
- include: default-server.yml
vars:
redis_conf_dir: "{{ redis_conf_dir_prefix }}"
redis_socket_dir: "{{ redis_socket_dir_prefix }}"
redis_pid_dir: "{{ redis_pid_dir_prefix }}"
redis_log_dir: "{{ redis_log_dir_prefix }}"
redis_data_dir: "{{ redis_data_dir_prefix }}"
- name: configure Redis for default mode
include: default-server.yml
when: redis_instance_name is not defined
- name: configure Redis for instance mode
include: instance-server.yml
when: redis_instance_name is defined
- name: Is Munin installed
stat:
path: /etc/munin/plugins
@ -63,7 +71,8 @@
- redis
- munin
- include: default-munin.yml
- name: configure Munin for default mode
include: default-munin.yml
when:
- _munin_installed.stat.exists
- _munin_installed.stat.isdir
@ -72,7 +81,8 @@
- redis
- munin
- include: instance-munin.yml
- name: configure Munin for instance mode
include: instance-munin.yml
when:
- _munin_installed.stat.exists
- _munin_installed.stat.isdir
@ -89,7 +99,8 @@
- redis
- log2mail
- include: default-log2mail.yml
- name: configure log2mail for default mode
include: default-log2mail.yml
when:
- _log2mail_installed.stat.exists
- _log2mail_installed.stat.isdir
@ -98,7 +109,8 @@
- redis
- log2mail
- include: instance-log2mail.yml
- name: configure log2mail for instance mode
include: instance-log2mail.yml
when:
- _log2mail_installed.stat.exists
- _log2mail_installed.stat.isdir


Loading…
Cancel
Save