2023-11-13 21:32:40 +05:30
|
|
|
# SPDX-FileCopyrightText: 2023 Aravinth Manivannan <realaravinth@batsense.net>
|
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
---
|
|
|
|
- name: Install redis-server
|
|
|
|
become: true
|
|
|
|
ansible.builtin.apt:
|
|
|
|
update_cache: true
|
2023-11-19 00:36:00 +05:30
|
|
|
cache_valid_time: 3600
|
2023-11-13 21:32:40 +05:30
|
|
|
pkg:
|
|
|
|
- redis-server
|
|
|
|
|
|
|
|
- name: Create Redis plugins dir
|
|
|
|
become: true
|
2023-11-19 00:36:00 +05:30
|
|
|
notify: restart redis
|
2023-11-13 21:32:40 +05:30
|
|
|
ansible.builtin.file:
|
|
|
|
path: /usr/lib/redis/modules
|
|
|
|
owner: redis
|
|
|
|
group: redis
|
|
|
|
state: directory
|
|
|
|
mode: "0755"
|
|
|
|
|
2023-11-19 00:36:00 +05:30
|
|
|
- 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"
|
|
|
|
|
2023-11-13 21:32:40 +05:30
|
|
|
- name: Copy custom Redis configuration
|
|
|
|
become: true
|
2023-11-19 00:36:00 +05:30
|
|
|
notify: restart redis
|
|
|
|
ansible.builtin.file:
|
|
|
|
path: "{{ item }}"
|
2023-11-13 21:32:40 +05:30
|
|
|
owner: redis
|
|
|
|
group: redis
|
|
|
|
force: true
|
2023-11-19 00:36:00 +05:30
|
|
|
loop:
|
|
|
|
- /etc/redis/redis.conf
|
|
|
|
- /etc/redis/
|
2023-11-13 21:32:40 +05:30
|
|
|
|
|
|
|
- name: Create download dir
|
|
|
|
ansible.builtin.file:
|
|
|
|
path: /tmp/cache-lib
|
|
|
|
state: directory
|
|
|
|
mode: "0755"
|
|
|
|
|
|
|
|
- name: Download plugin
|
|
|
|
ansible.builtin.get_url:
|
|
|
|
url: https://dl.mcaptcha.org/mcaptcha/cache/master/cache-master-linux-amd64.tar.gz
|
|
|
|
dest: /tmp/cache-lib/
|
|
|
|
checksum: sha256:https://dl.mcaptcha.org/mcaptcha/cache/master/cache-master-linux-amd64.tar.gz.sha256
|
|
|
|
|
|
|
|
- name: Extract cache-master-linux-amd64.tar.gz into /var/lib/foo
|
|
|
|
ansible.builtin.unarchive:
|
|
|
|
src: /tmp/cache-lib/cache-master-linux-amd64.tar.gz
|
|
|
|
remote_src: true
|
|
|
|
dest: /tmp/cache-lib/
|
|
|
|
|
|
|
|
- name: Copy custom Redis configuration
|
|
|
|
become: true
|
|
|
|
notify: restart redis
|
|
|
|
ansible.builtin.copy:
|
|
|
|
src: /tmp/cache-lib/cache-master-linux-amd64/libcache.so
|
|
|
|
remote_src: true
|
|
|
|
dest: /usr/lib/redis/modules/
|
|
|
|
owner: redis
|
|
|
|
group: redis
|
|
|
|
force: true
|
|
|
|
mode: "0755"
|
|
|
|
|
2023-12-09 02:52:24 +05:30
|
|
|
- name: Delete download dir
|
|
|
|
ansible.builtin.file:
|
|
|
|
path: /tmp/cache-lib
|
|
|
|
state: absent
|