wip-cache #2

Merged
realaravinth merged 6 commits from wip-cache into master 2023-12-09 02:58:16 +05:30
5 changed files with 20 additions and 27 deletions
Showing only changes of commit aced3188b2 - Show all commits

View file

@ -1,18 +0,0 @@
[Unit]
Description=Redis instance with mCaptcha cache module
After=network.target
Documentation=https://github.com/mCaptcha/cache
[Service]
Type=notify
ExecStart=/usr/bin/redis-server /etc/redis/redis.conf --supervised systemd --daemonize no
PIDFile=/run/redis/redis-server.pid
TimeoutStopSec=0
Restart=always
User=redis
Group=redis
RuntimeDirectory=redis
RuntimeDirectoryMode=2755
UMask=007
PrivateTmp=true

View file

@ -1,2 +0,0 @@
loadmodule /usr/lib/redis/modules/libcache.so
bind 0.0.0.0

View file

@ -6,7 +6,7 @@
ansible.builtin.import_playbook: base.yml
- name: Install redis cache
hosts: mcaptcha_demo_server
hosts: mcaptcha_hosts
remote_user: atm
pre_tasks:
- name: Ensure all VMs are reachable

View file

@ -1,5 +1,6 @@
- name: Restart redis
listen: restart redis
become: true
ansible.builtin.service:
name: redis
enabled: true

View file

@ -6,11 +6,13 @@
become: true
ansible.builtin.apt:
update_cache: true
cache_valid_time: 3600
pkg:
- redis-server
- name: Create Redis plugins dir
become: true
notify: restart redis
ansible.builtin.file:
path: /usr/lib/redis/modules
owner: redis
@ -18,15 +20,27 @@
state: directory
mode: "0755"
- name: Load mCaptcha module
become: true
notify: restart redis
ansible.builtin.lineinfile:
dest: /etc/redis/redis.conf
line: "{{ item }}"
loop:
- "loadmodule /usr/lib/redis/modules/libcache.so"
- "bind 0.0.0.0"
- name: Copy custom Redis configuration
become: true
ansible.builtin.copy:
src: ./artifacts/cache/redis.conf
dest: /etc/redis/
notify: restart redis
ansible.builtin.file:
path: "{{ item }}"
owner: redis
group: redis
force: true
mode: "0640"
loop:
- /etc/redis/redis.conf
- /etc/redis/
- name: Create download dir
ansible.builtin.file:
@ -70,5 +84,3 @@
rule: allow
proto: tcp
port: "6379"