homelab/roles/mastodon/tasks/redis.yml

62 lines
1.5 KiB
YAML

---
- name: Create redis-mastodon docker network
become: true
community.docker.docker_network:
name: redis-mastodon
- name: Create redis-mastodon docker volume
become: true
community.docker.docker_volume:
name: redis-mastodon
- name: Create /etc/redis/mastodon dir
become: true
ansible.builtin.file:
path: /etc/redis/mastodon
state: directory
mode: '1755'
owner: root
group: root
- name: Create /etc/redis/mastodon-cache dir
become: true
ansible.builtin.file:
path: /etc/redis/mastodon-cache
state: directory
mode: '1755'
owner: root
group: root
- name: Copy redis config
become: true
ansible.builtin.copy:
src: redis.conf
dest: /etc/redis/mastodon/redis.conf
- name: Copy redis cache config
become: true
ansible.builtin.copy:
src: redis-cache.conf
dest: /etc/redis/mastodon-cache/redis.conf
- name: Create redis container
become: true
community.docker.docker_container:
name: redis-mastodon
image: redis:7.4-bookworm
command: ["redis-server", "/etc/redis/redis.conf"]
networks:
- name: redis-mastodon
volumes:
- redis-mastodon:/data
- /etc/redis/mastodon:/etc/redis:ro
restart_policy: unless-stopped
- name: Create redis cache container
become: true
community.docker.docker_container:
name: redis-mastodon-cache
image: redis:7.4-bookworm
command: ["redis-server", "/etc/redis/redis.conf"]
networks:
- name: redis-mastodon
volumes:
- /etc/redis/mastodon-cache:/etc/redis:ro
restart_policy: unless-stopped