From f1f617ac9c5d317239a1b770e25216ea3efda2e7 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Mon, 30 May 2016 10:19:09 +0100 Subject: [PATCH] Update kibana cookbook for Ubuntu 16.04 --- cookbooks/kibana/metadata.rb | 1 + cookbooks/kibana/recipes/default.rb | 21 +++++++++---------- .../kibana/templates/default/kibana.conf.erb | 18 ---------------- 3 files changed, 11 insertions(+), 29 deletions(-) delete mode 100644 cookbooks/kibana/templates/default/kibana.conf.erb diff --git a/cookbooks/kibana/metadata.rb b/cookbooks/kibana/metadata.rb index a19cdfedb..4e1c8833b 100644 --- a/cookbooks/kibana/metadata.rb +++ b/cookbooks/kibana/metadata.rb @@ -6,3 +6,4 @@ description "Installs and configures a kibana server" long_description IO.read(File.join(File.dirname(__FILE__), "README.md")) version "1.0.0" depends "apache" +depends "systemd" diff --git a/cookbooks/kibana/recipes/default.rb b/cookbooks/kibana/recipes/default.rb index 30ee757aa..44ffb2983 100644 --- a/cookbooks/kibana/recipes/default.rb +++ b/cookbooks/kibana/recipes/default.rb @@ -63,6 +63,14 @@ directory "/var/log/kibana" do mode 0755 end +systemd_service "kibana@" do + description "Kibana server" + after "network.target" + user "kibana" + exec_start "/opt/kibana-#{version}/bin/kibana -c /etc/kibana/%i.yml" + restart "on-failure" +end + node[:kibana][:sites].each do |name, details| file "/etc/kibana/#{name}.yml" do content YAML.dump(YAML.load(File.read("/opt/kibana-#{version}/config/kibana.yml")).merge( @@ -75,19 +83,10 @@ node[:kibana][:sites].each do |name, details| owner "root" group "root" mode 0644 - notifies :restart, "service[kibana-#{name}]" - end - - template "/etc/init/kibana-#{name}.conf" do - source "kibana.conf.erb" - owner "root" - group "root" - mode 0644 - variables :config => "/etc/kibana/#{name}.yml" - notifies :restart, "service[kibana-#{name}]" + notifies :restart, "service[kibana@#{name}]" end - service "kibana-#{name}" do + service "kibana@#{name}" do action [:enable, :start] supports :status => true, :restart => true, :reload => false end diff --git a/cookbooks/kibana/templates/default/kibana.conf.erb b/cookbooks/kibana/templates/default/kibana.conf.erb deleted file mode 100644 index c81b9fa0a..000000000 --- a/cookbooks/kibana/templates/default/kibana.conf.erb +++ /dev/null @@ -1,18 +0,0 @@ -# kibana -# -# Startup script for kibana - -description "starts up kibana" - -start on (net-device-up - and local-filesystems - and runlevel [345]) -stop on runlevel [!345] - -setuid kibana - -script - exec /opt/kibana-<%= node[:kibana][:version] %>/bin/kibana -c <%= @config %> -end script - -respawn -- 2.39.5