Skip to content

Commit

Permalink
migrate redis installation from rpm to container-based
Browse files Browse the repository at this point in the history
  • Loading branch information
archanaserver committed Nov 27, 2024
1 parent 75c9a34 commit eced564
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
1 change: 1 addition & 0 deletions roles/redis/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
redis_image: registry.access.redhat.com/rhel9/redis-7:latest
26 changes: 20 additions & 6 deletions roles/redis/tasks/main.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,28 @@
---
- name: Install redis
ansible.builtin.package:
name: "redis"
- name: Pull Redis container image
containers.podman.podman_image:
name: "{{ redis_image }}"
state: present

- name: Start the Redis Service
ansible.builtin.systemd:
- name: Create directory for Redis data
ansible.builtin.file:
path: /data/redis
state: directory
owner: 1001
group: 1001
mode: '0755'

- name: Run Redis as a container
containers.podman.podman_container:
name: redis
enabled: true
image: "{{ redis_image }}"
state: started
volumes:
- /data/redis:/data:Z
- /data/redis/redis.conf:/usr/local/etc/redis/redis.conf:Z
ports:
- "6379:6379"
command: ["redis-server", "/usr/local/etc/redis/redis.conf"]

- name: Wait for Redis service to be accessible
ansible.builtin.wait_for:
Expand Down

0 comments on commit eced564

Please sign in to comment.