diff --git a/README.md b/README.md index 23709cf..1e91367 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,7 @@ Kibana requires ElasticSearch index to be configured to work as per logstash req * `node['kibana']['kibana3_version']` - Kibana3 exact version. * `node['kibana']['kibana4_version']` - Kibana4 exact version. * `node['kibana']['kibana5_version']` - Kibana5 exact version. +* `node['kibana']['kibana6_version']` - Kibana6 exact version. * `node['kibana']['base_dir']` - The base directory of kibana. Defaults to `/opt/kibana`. * `node['kibana']['user']` - The user under which Kibana is installed. Defaults to `kibana`. * `node['kibana']['group']` - The group under which Kibana is installed. Defaults to `kibana`. @@ -38,6 +39,7 @@ Kibana requires ElasticSearch index to be configured to work as per logstash req * `node['kibana']['kibana3_checksum']` - Checksum of the tarball. * `node['kibana']['kibana4_checksum']` - Checksum of the tarball. * `node['kibana']['kibana5_checksum']` - Checksum of the tarball. +* `node['kibana']['kibana6_checksum']` - Checksum of the tarball. * `node['kibana']['git']['url']` - The URL to Kibana repository. Defaults to `https://github.com/elasticsearch/kibana.git`. * `node['kibana']['git']['reference']` - The git reference in the Kibana repository. Defaults to `'v' + node['kibana']['kibana3_version']`. * `node['kibana']['rubyversion']` - The version of Ruby and Gems to use for Kibana. Defaults to `1.9.1`. @@ -82,6 +84,7 @@ Kibana requires ElasticSearch index to be configured to work as per logstash req * kibana::kibana3 * kibana::kibana4 * kibana::kibana5 +* kibana::kibana6 * kibana::nginx ## kibana::apache diff --git a/attributes/default.rb b/attributes/default.rb index a55b999..b4ad15b 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -18,6 +18,11 @@ default['kibana']['kibana5_checksum'] = '253dea10f0fa535c6c984981c4012559b43907d4bc6f21668b43295428cef21d' default['kibana']['kibana5_url'] = "https://artifacts.elastic.co/downloads/kibana/kibana-#{node['kibana']['kibana5_version']}-linux-x86_64.tar.gz" +#<> Kibana6 exact version, checksum, URL +default['kibana']['kibana6_version'] = '6.3.0' +default['kibana']['kibana6_checksum'] = 'f3d89d6d7239138e57ca87e834c52057db97a7acd7b6c0e6ac2ea642674c6992' +default['kibana']['kibana6_url'] = "https://artifacts.elastic.co/downloads/kibana/kibana-#{node['kibana']['kibana6_version']}-linux-x86_64.tar.gz" + #<> The base directory of kibana. default['kibana']['base_dir'] = '/opt/kibana' #<> The user under which Kibana is installed. diff --git a/recipes/kibana6.rb b/recipes/kibana6.rb new file mode 100644 index 0000000..952fc3b --- /dev/null +++ b/recipes/kibana6.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +include_recipe 'kibana' + +if node['kibana']['install_method'] == 'release' + ark 'kibana' do + url node['kibana']['kibana6_url'] + version node['kibana']['kibana6_version'] + checksum node['kibana']['kibana6_checksum'] + path node['kibana']['base_dir'] + home_dir File.join(node['kibana']['base_dir'], 'current') + owner node['kibana']['user'] + end + config_path = 'current/config/kibana.yml' +elsif node['kibana']['install_method'] == 'package' + node.default['kibana']['service']['bin_path'] = 'bin' + if platform_family? 'debian' + apt_repository 'kibana' do + uri node['kibana']['repository_url'] + distribution '' + components %w[stable main] + key node['kibana']['repository_key'] + end + else + Chef::Log.warn "I do not support your platform: #{node['platform_family']}" + end + + package 'kibana' + config_path = 'config/kibana.yml' +else + Chef::Application.fatal!("Since Kibana version 4, install method can only be only 'release' or 'package'") +end + +# Install service +include_recipe 'kibana::_service' + +# Apply config template +template File.join(node['kibana']['base_dir'], config_path) do + cookbook node['kibana']['config']['cookbook'] + source 'kibana6.yml.erb' + owner node['kibana']['user'] + group node['kibana']['group'] + mode '0644' + variables( + bind: node['kibana']['interface'], + port: node['kibana']['port'], + es_user: node['kibana']['elasticsearch']['user'] || 'kibana', + es_pass: node['kibana']['elasticsearch']['password'] || 'kibana', + es_host: node['kibana']['elasticsearch']['hosts'].first, + es_port: node['kibana']['elasticsearch']['port'], + index: node['kibana']['index'], + defaultapp: node['kibana']['defaultapp'], + logging_option: node['kibana']['logging_option'], + extra_config: node['kibana']['extra_config'] + ) + notifies :restart, 'service[kibana]' +end diff --git a/templates/default/kibana6.yml.erb b/templates/default/kibana6.yml.erb new file mode 100644 index 0000000..6ae6c17 --- /dev/null +++ b/templates/default/kibana6.yml.erb @@ -0,0 +1,71 @@ +# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +# !! Managed by Chef, do not edit !! +# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +# Kibana is served by a back end server. This controls which port to use. +server.port: <%= @port %> + +# The host to bind the server to. +server.host: "<%= @bind %>" + +# The Elasticsearch instance to use for all your queries. +elasticsearch.url: "http://<%= @es_host %>:<%= @es_port %>" + +# preserve_elasticsearch_host true will send the hostname specified in `elasticsearch`. If you set it to false, +# then the host you use to connect to *this* Kibana instance will be sent. +elasticsearch.preserveHost: true + +# Kibana uses an index in Elasticsearch to store saved searches, visualizations +# and dashboards. It will create a new index if it doesn't already exist. +kibana.index: "<%= @index %>" + +# If your Elasticsearch is protected with basic auth, this is the user credentials +# used by the Kibana server to perform maintence on the kibana_index at statup. Your Kibana +# users will still need to authenticate with Elasticsearch (which is proxied thorugh +# the Kibana server) +elasticsearch.username: <%= @es_user %> +elasticsearch.password: <%= @es_pass %> + +# Optional settings that provide the paths to the PEM-format SSL certificate and key files. +# These files validate that your Elasticsearch backend uses the same key files. +# elasticsearch.ssl.cert: /path/to/your/client.crt +# elasticsearch.ssl.key: /path/to/your/client.key + +# If you need to provide a CA certificate for your Elasticsarech instance, put +# the path of the pem file here. +# elasticsearch.ssl.ca: /path/to/your/CA.pem + +# The default application to load. +kibana.defaultAppId: "<%= @defaultapp %>" + +# Time in milliseconds to wait for elasticsearch to respond to pings, defaults to +# request_timeout setting +# elasticsearch.pingTimeout: 1500 + +# Time in milliseconds to wait for responses from the back end or elasticsearch. +# This must be > 0 +elasticsearch.requestTimeout: 300000 + +# Time in milliseconds for Elasticsearch to wait for responses from shards. +# Set to 0 to disable. +elasticsearch.shardTimeout: 0 + +# Time in milliseconds to wait for Elasticsearch at Kibana startup before retrying +# elasticsearch.startupTimeout: 5000 + +# SSL for outgoing requests from the Kibana Server (PEM formatted) +# server.ssl.cert: /path/to/your/server.key +# server.ssl.key: /path/to/your/server.crt + +# Set the path to where you would like the process id file to be created. +# pid.file: /var/run/kibana.pid + +# If you would like to send the log output to a file you can set the path below. +# This will also turn off the STDOUT log output. +# logging.dest: ./kibana.log +<%= @logging_option -%> + +# Extra config +<% @extra_config.each do |k,v| %> +<%= k %>: <%= v %> +<% end %>