forgejo-autohebergement/ansible/roles/forgejo/tasks/redis.yml
Horacio Duran 822e42dbb8 Add Template to deploy forgejo.
This template allows deploying a forgejo en either Scaleway or Hetzner
(untested) without much knowledge about them.
It DOES require knowledge about Terragrunt and ansible. A wizard of
sorts is provided but it will not guarantee success without some
knowledge about the underlying technology.
2026-01-09 16:07:44 +01:00

40 lines
999 B
YAML

---
# Redis setup tasks
- name: Install Redis
ansible.builtin.apt:
name:
- redis-server
- redis-tools
state: present
update_cache: yes
become: yes
- name: Configure Redis
ansible.builtin.lineinfile:
path: /etc/redis/redis.conf
regexp: "{{ item.regexp }}"
line: "{{ item.line }}"
state: present
become: yes
loop:
- { regexp: '^bind', line: 'bind 127.0.0.1 ::1' }
- { regexp: '^protected-mode', line: 'protected-mode yes' }
- { regexp: '^maxmemory', line: 'maxmemory 256mb' }
- { regexp: '^maxmemory-policy', line: 'maxmemory-policy allkeys-lru' }
- { regexp: '^save', line: 'save 900 1' }
notify: Restart Redis
- name: Ensure Redis is started and enabled
ansible.builtin.systemd:
name: redis-server
state: started
enabled: yes
become: yes
- name: Test Redis connection
ansible.builtin.command:
cmd: redis-cli ping
register: redis_ping
changed_when: false
failed_when: redis_ping.stdout != "PONG"