redis #4
1
attributes/redis.rb
Normal file
1
attributes/redis.rb
Normal file
@ -0,0 +1 @@
|
||||
default['redis']['unix']['path'] = '/var/run/redis/redis.sock'
|
19
recipes/redis.rb
Normal file
19
recipes/redis.rb
Normal file
@ -0,0 +1,19 @@
|
||||
apt_package 'redis-server'
|
||||
|
||||
template '/etc/redis/local.conf' do
|
||||
source 'redis/local.conf'
|
||||
end
|
||||
|
||||
if node['redis']['unix']['perm']
|
||||
bash 'append_to_config' do
|
||||
user 'root'
|
||||
code <<~EOF
|
||||
echo "include /etc/redis/local.conf" >> /etc/redis/redis.conf
|
||||
EOF
|
||||
not_if 'grep -q "/etc/redis/local.conf" /etc/redis/redis.conf'
|
||||
end
|
||||
end
|
||||
|
||||
systemd_unit 'redis-server.service' do
|
||||
action :restart
|
||||
end
|
7
templates/redis/local.conf
Normal file
7
templates/redis/local.conf
Normal file
@ -0,0 +1,7 @@
|
||||
# Specify the path for the Unix socket that will be used to listen for
|
||||
# incoming connections. There is no default, so Redis will not listen
|
||||
# on a unix socket when not specified.
|
||||
#
|
||||
|
||||
unixsocket <%= node['redis']['unix']['path'] %>
|
||||
unixsocketperm <%= node['redis']['unix']['perm'] %>
|
Loading…
x
Reference in New Issue
Block a user