-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Consolidate Redis roles * Use handlers in redis role Separate out basic configuration tasks in redis role Fix issue with determining the Redis version when installing from source * Update Redis readme * Remove redis_replication and redis_auth references --------- Co-authored-by: Steven Schattenberg <122639296+steven-schattenberg-itential@users.noreply.github.com>
- Loading branch information
1 parent
5389081
commit 0504b21
Showing
18 changed files
with
250 additions
and
421 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,18 @@ | ||
# Copyright (c) 2024, Itential, Inc | ||
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) | ||
--- | ||
- name: Restart Redis | ||
- name: Enable and Start Redis | ||
throttle: 1 | ||
ansible.builtin.systemd: | ||
name: redis | ||
enabled: true | ||
state: restarted | ||
daemon_reload: true | ||
|
||
- name: Restart Sentinel | ||
- name: Enable and Start Redis Sentinel | ||
throttle: 1 | ||
ansible.builtin.systemd: | ||
name: redis-sentinel | ||
enabled: true | ||
state: restarted | ||
daemon_reload: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
# Copyright (c) 2024, Itential, Inc | ||
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) | ||
--- | ||
# Kernel Adjust | ||
# Memory overcommit must be enabled! Without it, a background save or replication may fail under low memory condition. | ||
# Being disabled, it can can also cause failures without low memory condition, see https://github.com/jemalloc/jemalloc/issues/1328 | ||
- name: Adjust Memory Overcommit | ||
ansible.posix.sysctl: | ||
name: vm.overcommit_memory | ||
value: 1 | ||
|
||
- name: Install custom SELinux profiles | ||
ansible.builtin.include_role: | ||
name: selinux | ||
tags: configure_selinux | ||
|
||
# Check if firewalld is running, if it is then open the appropriate ports | ||
- name: Gather service facts | ||
ansible.builtin.service_facts: | ||
|
||
- name: Open Ports on FirewallD Public Zone | ||
ansible.posix.firewalld: | ||
port: "{{ item }}" | ||
permanent: true | ||
state: enabled | ||
zone: public | ||
immediate: true | ||
loop: | ||
- "{{ redis_port }}/tcp" | ||
- "{{ redis_replication | bool | ternary(rabbitmq_mgt_console_port ~ '/tcp', omit) }}" | ||
when: | ||
- ansible_facts.services["firewalld.service"] is defined | ||
- ansible_facts.services["firewalld.service"].state == "running" | ||
- ansible_facts.services["firewalld.service"].status == "enabled" | ||
|
||
- name: Create Redis group | ||
ansible.builtin.group: | ||
name: "{{ redis_group }}" | ||
|
||
- name: Create Redis user | ||
ansible.builtin.user: | ||
name: "{{ redis_owner }}" | ||
group: "{{ redis_group }}" | ||
state: present | ||
|
||
- name: Create Redis data directory | ||
ansible.builtin.file: | ||
state: directory | ||
path: "{{ redis_data_dir }}" | ||
owner: "{{ redis_owner }}" | ||
group: "{{ redis_group }}" | ||
mode: "0755" | ||
when: redis_data_dir != "/var/lib/redis" or redis_install_method == "source" | ||
|
||
- name: Create Redis log directory | ||
ansible.builtin.file: | ||
state: directory | ||
path: "{{ redis_log_dir }}" | ||
owner: "{{ redis_owner }}" | ||
group: "{{ redis_group }}" | ||
mode: "0755" | ||
when: redis_log_dir != "/var/log/redis" or redis_install_method == "source" | ||
|
||
- name: Create Redis pid directory | ||
ansible.builtin.file: | ||
state: directory | ||
path: "{{ redis_pid_dir }}" | ||
owner: "{{ redis_owner }}" | ||
group: "{{ redis_group }}" | ||
mode: "0755" | ||
when: redis_pid_dir != "/var/run" or redis_install_method == "source" | ||
|
||
- name: Create Redis configuration directory | ||
ansible.builtin.file: | ||
path: "{{ redis_conf_path }}" | ||
state: directory | ||
owner: "{{ redis_owner }}" | ||
group: "{{ redis_group }}" | ||
mode: "0760" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# Copyright (c) 2024, Itential, Inc | ||
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) | ||
--- | ||
- name: Configure Sentinel | ||
notify: Enable and Start Redis Sentinel | ||
block: | ||
- name: Create Redis Sentinel systemd file | ||
ansible.builtin.template: | ||
src: redis-sentinel.service.j2 | ||
dest: /usr/lib/systemd/system/redis-sentinel.service | ||
owner: root | ||
group: root | ||
mode: "0644" | ||
|
||
- name: Use template to generate sentinel.conf | ||
ansible.builtin.template: | ||
src: sentinel.conf.j2 | ||
dest: "{{ redis_sentinel_conf_file }}" | ||
owner: "{{ redis_owner }}" | ||
group: "{{ redis_group }}" | ||
mode: "0640" | ||
backup: true | ||
when: | ||
- groups['redis'] is defined | ||
- inventory_hostname in groups['redis'] | ||
vars: | ||
master_name: "{{ hostvars[groups['redis'][0]].inventory_hostname }}" | ||
|
||
- name: Use template to generate sentinel.conf for secondary DR | ||
ansible.builtin.template: | ||
src: sentinel.conf.j2 | ||
dest: "{{ redis_sentinel_conf_file }}" | ||
owner: "{{ redis_owner }}" | ||
group: "{{ redis_group }}" | ||
mode: "0640" | ||
backup: true | ||
when: | ||
- groups['redis_secondary'] is defined | ||
- inventory_hostname in groups['redis_secondary'] | ||
vars: | ||
master_name: "{{ hostvars[groups['redis_secondary'][0]].inventory_hostname }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.