[Unit]
Description=Redis {% if redis_mode == 'sentinel' %}Sentinel {% endif %}Instance {{ redis_cluster }}-{{ redis_node }}-{{ port }} @ {{ inventory_hostname }}:{{ port }}
Documentation=https://redis.io/documentation
#AssertPathExists=/var/log/redis
#AssertPathExists=/var/run/redis
#AssertPathExists={{ redis_fs_main }}/redis/{{ redis_cluster }}-{{ redis_node }}-{{ port }}
AssertPathExists=/etc/redis/{{ redis_cluster }}-{{ redis_node }}-{{ port }}.conf

[Service]
ExecStart=/bin/redis-server /etc/redis/{{ redis_cluster }}-{{ redis_node }}-{{ port }}.conf {% if redis_mode == 'sentinel' %}--sentinel {% endif %}--daemonize no --supervised systemd
ExecStop=/usr/libexec/redis-shutdown {{ redis_cluster }}-{{ redis_node }}-{{ port }}
#ExecStop=/bin/redis-cli -p {{ port }} shutdown
WorkingDirectory={{ redis_fs_main }}/redis/{{ redis_cluster }}-{{ redis_node }}-{{ port }}
PIDFile=/var/run/redis/{{ redis_cluster }}-{{ redis_node }}-{{ port }}.pid
LimitNOFILE=10032
TimeoutStartSec=60
TimeoutStopSec=60
UMask=0077
User=redis
Group=redis
Restart=on-failure

[Install]
WantedBy=multi-user.target