diff options
author | Christian Pointner <equinox@spreadspace.org> | 2024-07-15 23:42:17 +0200 |
---|---|---|
committer | Christian Pointner <equinox@spreadspace.org> | 2024-07-15 23:42:17 +0200 |
commit | 062c0cc41a38b003e614dc2c49cd22da304c838f (patch) | |
tree | 46ccbeddf69dd5fa45304e2e5e6d7e3b7a0622cd | |
parent | add minimalistc redis-server role (diff) |
redis-server: add configurable storage volume
-rw-r--r-- | inventory/host_vars/ch-testvm-prometheus.yml | 7 | ||||
-rw-r--r-- | roles/redis/server/defaults/main.yml | 3 | ||||
-rw-r--r-- | roles/redis/server/tasks/main.yml | 16 |
3 files changed, 26 insertions, 0 deletions
diff --git a/inventory/host_vars/ch-testvm-prometheus.yml b/inventory/host_vars/ch-testvm-prometheus.yml index 147e0fe3..98c128b5 100644 --- a/inventory/host_vars/ch-testvm-prometheus.yml +++ b/inventory/host_vars/ch-testvm-prometheus.yml @@ -41,6 +41,13 @@ sshd_allowusers_host: "{{ normal_users_host | union(admin_users_host) | union([' ## test +redis_server_storage: + type: lvm + vg: "{{ host_name }}" + lv: redis + size: 1G + fs: ext4 + redis_server_legacy_auth_password: "changeme" diff --git a/roles/redis/server/defaults/main.yml b/roles/redis/server/defaults/main.yml index b67716c7..58cf8ecc 100644 --- a/roles/redis/server/defaults/main.yml +++ b/roles/redis/server/defaults/main.yml @@ -1,2 +1,5 @@ --- +# redis_server_storage: +# type: ... + # redis_server_legacy_auth_password: "very-secret" diff --git a/roles/redis/server/tasks/main.yml b/roles/redis/server/tasks/main.yml index 8114bced..8cd44ee5 100644 --- a/roles/redis/server/tasks/main.yml +++ b/roles/redis/server/tasks/main.yml @@ -1,10 +1,26 @@ --- +- name: prepare storage volume for /var/lib/redis + when: redis_server_storage is defined + vars: + storage_volume: "{{ redis_server_storage | combine({'dest': '/var/lib/redis'}) }}" + include_role: + name: "storage/{{ redis_server_storage.type }}/volume" + - name: install redis-server packages apt: name: - redis-server state: present +- name: make sure redis can write storage directory + file: + path: /var/lib/redis + state: directory + owner: redis + group: redis + mode: 0750 + notify: restart redis-server + - name: configure legacy authentication password when: redis_server_legacy_auth_password is defined lineinfile: |