wip-cache #2
5 changed files with 20 additions and 27 deletions
18
ansible/artifacts/cache/cache.service
vendored
18
ansible/artifacts/cache/cache.service
vendored
|
@ -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
|
2
ansible/artifacts/cache/redis.conf
vendored
2
ansible/artifacts/cache/redis.conf
vendored
|
@ -1,2 +0,0 @@
|
|||
loadmodule /usr/lib/redis/modules/libcache.so
|
||||
bind 0.0.0.0
|
|
@ -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
|
||||
|
|
1
ansible/roles/cache/handlers/main.yml
vendored
1
ansible/roles/cache/handlers/main.yml
vendored
|
@ -1,5 +1,6 @@
|
|||
- name: Restart redis
|
||||
listen: restart redis
|
||||
become: true
|
||||
ansible.builtin.service:
|
||||
name: redis
|
||||
enabled: true
|
||||
|
|
24
ansible/roles/cache/tasks/main.yml
vendored
24
ansible/roles/cache/tasks/main.yml
vendored
|
@ -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"
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue