src.dualinventive.com/devops/ansible/external-roles/redis/templates/redis-server.service.j2

44 lines
1.3 KiB
Django/Jinja

# {{ ansible_managed }}
[Unit]
Description=Advanced key-value store
After=network.target
Documentation=http://redis.io/documentation, man:redis-server(1)
[Service]
Type=forking
ExecStart=/usr/bin/redis-server /etc/redis/{{ item.name }}.conf
PIDFile=/var/run/redis-{{ item.name }}/redis.pid
TimeoutStopSec=0
Restart=always
User={{ item.user }}
Group={{ item.user }}
RuntimeDirectory=redis-{{ item.name }}
RuntimeDirectoryMode=2755
ExecStartPre=-/bin/run-parts --verbose /etc/redis/redis-server.pre-up.d
ExecStartPost=-/bin/run-parts --verbose /etc/redis/redis-server.post-up.d
ExecStop=-/bin/run-parts --verbose /etc/redis/redis-server.pre-down.d
ExecStop=/bin/kill -s TERM $MAINPID
ExecStopPost=-/bin/run-parts --verbose /etc/redis/redis-server.post-down.d
UMask=007
PrivateTmp=yes
LimitNOFILE=65535
PrivateDevices=yes
ProtectHome=yes
ReadOnlyDirectories=/
ReadWriteDirectories=-/var/lib/redis
ReadWriteDirectories=-/var/log/redis
ReadWriteDirectories=-/var/run/redis-{{ item.name }}
CapabilityBoundingSet=~CAP_SYS_PTRACE
# redis-server can write to its own config file when in cluster mode so we
# permit writing there by default. If you are not using this feature, it is
# recommended that you replace the following lines with "ProtectSystem=full".
ProtectSystem=full
ReadWriteDirectories=-/etc/redis
[Install]
WantedBy=multi-user.target
Alias=redis-{{ item.name }}.service