daemonize yes
pidfile "{{ redis_pid_dir }}/redis-server.pid"
port {{ redis_port }}
bind {{ redis_bind_interfaces | join(' ') }}

{% if redis_socket_enabled %}
unixsocket "{{ redis_socket_dir }}/redis.sock"
unixsocketperm {{ redis_socket_perms }}
{% endif %}

{% if redis_password %}
requirepass "{{ redis_password }}"
{% endif %}
{% if redis_password_master %}
masterauth "{{ redis_password_master }}"
{% endif %}

timeout {{ redis_timeout }}

loglevel {{ redis_log_level }}
logfile "{{ redis_log_dir }}/redis-server.log"

# To enable logging to the system logger, just set 'syslog-enabled' to yes,
# and optionally update the other syslog parameters to suit your needs.
# syslog-enabled no
# syslog-ident redis
# syslog-facility local0

databases {{ redis_databases }}

{% for save in redis_save %}
save {{ save }}
{% endfor %}

rdbcompression {{ redis_rdbcompression | bool | ternary('yes','no') }}
dbfilename "{{ redis_data_file }}"
dir "{{ redis_data_dir }}"

{% if redis_installed_version is version('3.2', '>=') %}
protected-mode {{ redis_protected_mode | bool | ternary('yes','no') }}
{% endif %}

{% if redis_maxclients %}
maxclients {{ redis_maxclients }}
{% endif %}

{% if redis_maxmemory %}
maxmemory {{ redis_maxmemory }}
maxmemory-policy {{ redis_maxmemory_policy }}
maxmemory-samples {{ redis_maxmemory_samples }}
{% endif %}

appendonly {{ redis_appendonly | bool | ternary('yes','no') }}
appendfsync {{ redis_appendfsync }}
no-appendfsync-on-rewrite no

{% for disabled_command in redis_disabled_commands %}
rename-command {{ disabled_command }} ""
{% endfor %}

{% for include in redis_includes %}
include {{ include }}
{% endfor %}
