vkhatri / chef-elasticsearch-cluster

Chef Cookbook to Manage ElasticSearch Cluster
https://supermarket.chef.io/cookbooks/elasticsearch-cluster
Apache License 2.0
11 stars 8 forks source link

elasticsearch-cluster Cookbook

Cookbook Build Status

This is a Chef cookbook to manage ElasticSearch Cluster.

More features and attributes will be added over time, feel free to contribute what you find missing!

For Production environment, always prefer the most recent release.

Dependency

Most Recent Release

cookbook 'elasticsearch-cluster', '~> 0.5.6'

From Git

cookbook 'elasticsearch-cluster', github: 'vkhatri/chef-elasticsearch-cluster',  tag: 'v0.5.6'

Repository

https://github.com/vkhatri/chef-elasticsearch-cluster

Supported OS

This cookbook was tested on Amazon (2015-03) & Ubuntu (14.04) Linux and expected to work on similar platform family OS.

Supported ElasticSearch Version

This cookbook was tested for ElasticSearch v1.6.0+.

Supported ElasticSearch Deployment

This cookbook supports both Package and Tarball based installation.

Cookbook Dependencies

TODO

Recipes

HWRP elasticsearch_plugin

HWRP elasticsearch_plugin manages elasticsearch plugins install / remove. It is a wrapper for plugin binary.

For plugins validation (exists or not), it uses node API call to verify wheter required plugin or plugin version is installed.

version is evaluated to verify the correct installed version. Github plugins version vX.Y.Z is not the same as plugin installed version X.Y.Z discovered by provider. Check provider for more details.

Install Plugin

elasticsearch_plugin 'cloud-aws' do
  install_source   'elasticsearch/elasticsearch-cloud-aws'
  version        '2.7.0'
end

elasticsearch_plugin 'kopf' do
  install_source 'lmenezes/elasticsearch-kopf'
end

Above HWRP resource will install two plugins: cloud-aws and kopf.

Remove Plugin

elasticsearch_plugin 'kopf' do
  action :remove
end

Above HWRP resource will remove the kopf plugin.

HWRP Options

HWRP elasticsearch_script

HWRP elasticsearch_script manages elasticsearch scripts under directory node['elasticsearch']['scripts_dir']. It is a wrapper for cookbook_file resource to manage scripts.

Install Script

elasticsearch_script 'foo' do
  cookbook 'cookbook'
  source 'source'
end

Above HWRP resource will add script foo.

Remove Script

elasticsearch_script 'foo' do
  action :delete
end

Above HWRP resource will remove script foo.

HWRP Options

Manage Plugins using Node attribute

Using recipe plugins, plugins can be installed or removed by node attribute node['elasticsearch']['plugins']. Below is the role attributes to install and remove plugins.

  "default_attributes": {
    "elasticsearch": {
      "plugins": {
        "bigdesk": {
          "install_source": "lukas-vlcek/bigdesk"
        },
        "kopf": {
          "install_source": "lmenezes/elasticsearch-kopf"
        },
        "head": {
          "action": "remove"
        }
      }
    }
  }

Check out HWRP elasticsearch_plugin or recipe plugins for more info on attributes.

Manage Scripts using Node attribute

Using recipe scripts, scripts can be added or deleted by node attribute node['elasticsearch']['scripts']. Below is the role attributes to add and delete scripts.

  "default_attributes": {
    "elasticsearch": {
      "plugins": {
        "script-name": {
          "cookbook": "foo",
          "source": "foo"
        }
      }
    }
  }

Check out HWRP elasticsearch_script or recipe scripts for more info on attributes.

Cookbook Advanced Attributes

Cookbook Core Attributes

Service Attributes

ElasticSearch v1.x, 2.x Configuration File Attributes

ElasticSearch v5.x Configuration File Attributes

ElasticSearch Configuration From Data Bag Item

'elasticsearch' => {
    'databag_configs' => [
      {
        'name' => 'aws_keys',
        'item' => 'elasticsearch',
        'config_items' => {
          'cloud.aws.access_key' => 'data_bag_key_for_access_key',
          'cloud.aws.secret_key' => 'data_bag_key_for_secret_key'
        }
      }
    ]
}

Elasticsearch YUM/APT Repository Attributes

ElasticSearch v5.x Configuration File Attributes

Contributing

  1. Fork the repository on Github
  2. Create a named feature branch (like add_component_x)
  3. Write your change
  4. Write tests for your change (if applicable)
  5. Run the tests (rake & rake knife), ensuring they all pass
  6. Write new resource/attribute description to README.md
  7. Write description about changes to PR
  8. Submit a Pull Request using Github

Copyright & License

Authors:: Virender Khatri and Contributors

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.