use dedicated systemd env file
Some checks failed
continuous-integration/drone/pr Build is failing

This commit is contained in:
Robert Kaussow 2023-08-05 23:49:35 +02:00
parent 3bebe077a8
commit 2c2b3f789c
Signed by: xoxys
GPG Key ID: 4E692A2EAECC03C0
5 changed files with 26 additions and 20 deletions

View File

@ -44,7 +44,7 @@ redis_podman_args:
- --health-retries=6 - --health-retries=6
- --health-on-failure=kill - --health-on-failure=kill
redis_loglevel: "notice" redis_log_level: "notice"
redis_timeout: 300 redis_timeout: 300
redis_databases: 16 redis_databases: 16

View File

@ -25,13 +25,16 @@
set_fact: set_fact:
__redis_volumes_map: "{{ __redis_volumes_raw.results | json_query('[].volume') | items2dict(key_name='Name', value_name='Mountpoint') }}" __redis_volumes_map: "{{ __redis_volumes_raw.results | json_query('[].volume') | items2dict(key_name='Name', value_name='Mountpoint') }}"
- name: Deploy redis env file - name: Deploy redis env files
template: template:
src: etc/containers/systemd/redis.env.j2 src: "etc/containers/systemd/{{ item }}.j2"
dest: "/etc/containers/systemd/redis.env" dest: "/etc/containers/systemd/{{ item }}"
owner: root owner: root
group: root group: root
mode: "0640" mode: "0640"
loop:
- redis.env
- redis.sys.env
notify: __redis_restart notify: __redis_restart
- name: Create container specs - name: Create container specs

View File

@ -7,12 +7,13 @@ WantedBy=default.target
Restart=on-failure Restart=on-failure
RestartSec=5s RestartSec=5s
EnvironmentFile=/etc/containers/systemd/redis.env EnvironmentFile=/etc/containers/systemd/redis.sys.env
ExecReload=/usr/bin/podman kill --signal=SIGHUP %p ExecReload=/usr/bin/podman kill --signal=SIGHUP %p
[Container] [Container]
Image={{ redis_image }} Image={{ redis_image }}
Exec=redis-server $REDIS_ARGS Exec=redis-server $REDIS_ARGS
EnvironmentFile=/etc/containers/systemd/redis.env
User=999 User=999
Group=999 Group=999
{% for item in redis_volumes %} {% for item in redis_volumes %}

View File

@ -1,17 +1,2 @@
#jinja2: lstrip_blocks: True #jinja2: lstrip_blocks: True
{{ ansible_managed | comment }} {{ ansible_managed | comment }}
REDIS_ARGS=--timeout {{ redis_timeout }} --loglevel {{ redis_loglevel }} --databases {{ redis_databases }} \
{% for save in redis_save %}
--save '{{ save }}'\
{% endfor %}
--rdbcompression {{ redis_rdbcompression | bool | ternary("yes", "no") }} \
--appendonly {{ redis_appendonly | bool | ternary("yes", "no") }} \
--appendfsync {{ redis_appendfsync }} \
--no-appendfsync-on-rewrite no \
{% if redis_requirepass is defined %}
--requirepass {{ redis_requirepass }} \
{% endif %}
{% for command in redis_disabled_commands %}
--rename-command '{{ command }} ""' \
{% endfor %}
--port 6379

View File

@ -0,0 +1,17 @@
#jinja2: lstrip_blocks: True
{{ ansible_managed | comment }}
REDIS_ARGS=--timeout {{ redis_timeout }} --loglevel {{ redis_log_level }} --databases {{ redis_databases }} \
{% for save in redis_save %}
--save '{{ save }}'\
{% endfor %}
--rdbcompression {{ redis_rdbcompression | bool | ternary("yes", "no") }} \
--appendonly {{ redis_appendonly | bool | ternary("yes", "no") }} \
--appendfsync {{ redis_appendfsync }} \
--no-appendfsync-on-rewrite no \
{% if redis_requirepass is defined %}
--requirepass {{ redis_requirepass }} \
{% endif %}
{% for command in redis_disabled_commands %}
--rename-command '{{ command }} ""' \
{% endfor %}
--port 6379