diff --git a/roles/redis/defaults/main.yml b/roles/redis/defaults/main.yml index 4e4829a..12a3a53 100644 --- a/roles/redis/defaults/main.yml +++ b/roles/redis/defaults/main.yml @@ -2,3 +2,4 @@ redis_enabled: false redis_port: 6379 redis_password: 1XoRW/Vgz+LdKLXeh9uwdBrYPBJKhIJR +redis_data_directory: /opt/conda-store/redis/ diff --git a/roles/redis/tasks/redis.yaml b/roles/redis/tasks/redis.yaml index 02293d5..6394ec7 100644 --- a/roles/redis/tasks/redis.yaml +++ b/roles/redis/tasks/redis.yaml @@ -14,6 +14,14 @@ shell: echo "deb [signed-by=/usr/share/keyrings/redis-archive-keyring.gpg] https://packages.redis.io/deb $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/redis.list become: true +- name: Ensure Redis data directory exists + ansible.builtin.file: + path: "{{ redis_data_directory }}" + state: directory + owner: redis + group: redis + mode: '0755' + - name: Install redis apt: name: redis @@ -21,23 +29,6 @@ update_cache: yes become: true -#- name: Add Redis PPA -# ansible.builtin.apt_repository: -# repo: "ppa:redislabs/redis" -# state: present -# become: true -# -#- name: Update apt cache -# ansible.builtin.apt: -# update_cache: yes -# become: true -# -#- name: Install specific Redis version -# ansible.builtin.apt: -# name: "redis-server=7.2*" -# state: present -# become: true - - name: Ensure Redis is started service: name=redis-server state=started enabled=yes become: true diff --git a/roles/redis/templates/redis.conf.j2 b/roles/redis/templates/redis.conf.j2 index f9e5424..ec604dd 100644 --- a/roles/redis/templates/redis.conf.j2 +++ b/roles/redis/templates/redis.conf.j2 @@ -507,7 +507,7 @@ rdb-del-sync-files no # The Append Only File will also be created inside this directory. # # Note that you must specify a directory here, not a file name. -dir ./ +dir {{ redis_data_directory }} ################################# REPLICATION #################################