elasticsearch
Version information
This version is compatible with:
- Puppet Enterprise >= 3.1.3
- Puppet >=2.7.20 <4.0.0
- , , , , , ,
Start using this module
Add this module to your Puppetfile:
mod 'aniketmehta-elasticsearch', '0.1.0'
Learn more about managing modules with a PuppetfileDocumentation
#Elasticsearch Puppet module
####Table of Contents
- Overview
- Module description - What the module does and why it is useful
- Setup - The basics of getting started with Elasticsearch
- Usage - Configuration options and additional functionality
- Advanced features - Extra information on advanced usage
- Limitations - OS compatibility, etc.
- Development - Guide for contributing to the module
- Support - When you need help with this module
##Overview
This module manages Elasticsearch (http://www.elasticsearch.org/overview/elasticsearch/)
##Module description
The elasticsearch module sets up Elasticsearch instances and can manage plugins and templates.
This module has been tested against ES 1.0 and up.
##Setup
###The module manages the following
- Elasticsearch repository files.
- Elasticsearch package.
- Elasticsearch configuration file.
- Elasticsearch service.
- Elasticsearch plugins.
- Elasticsearch templates.
###Requirements
- The stdlib Puppet library.
Repository management
When using the repository management you will need the following dependency modules:
- Debian/Ubuntu: Puppetlabs/apt
- OpenSuSE: Darin/zypprepo
##Usage
###Main class
####Install a specific version
class { 'elasticsearch':
version => '1.2.1'
}
Note: This will only work when using the repository.
####Automatic upgrade of the software ( default set to false )
class { 'elasticsearch':
autoupgrade => true
}
####Removal/decommissioning
class { 'elasticsearch':
ensure => 'absent'
}
####Install everything but disable service(s) afterwards
class { 'elasticsearch':
status => 'disabled'
}
###Instances
This module works with the concept of instances.
####Quick setup
elasticsearch::instance { 'es-01': }
This will set up its own data directory and set the node name to $hostname-$instance_name
####Advanced options
Instance specific options can be given:
elasticsearch::instance { 'es-01':
config => { }, # Configuration hash
init_defaults => { }, # Init defaults hash
datadir => [ ], # Data directory
}
See Advanced features for more information
###Plug-ins
Install a variety of plugins:
####From official repository
elasticsearch::plugin{'lmenezes/elasticsearch-kopf':
module_dir => 'kopf'
}
####From custom url
elasticsearch::plugin{ 'elasticsearch-jetty':
module_dir => 'jetty',
url => 'https://oss-es-plugins.s3.amazonaws.com/elasticsearch-jetty/elasticsearch-jetty-1.2.1.zip'
}
###Templates
Add a new template
This will install and/or replace the template in Elasticsearch:
elasticsearch::template { 'templatename':
file => 'puppet:///path/to/template.json'
}
Delete a template
elasticsearch::template { 'templatename':
ensure => 'absent'
}
Host
By default it uses localhost:9200 as host. you can change this with the host
and port
variables
elasticsearch::template { 'templatename':
host => $::ipaddress,
port => 9200
}
###Bindings / Clients
Install a variety of clients/bindings:
####Python
elasticsearch::python { 'rawes': }
####Ruby
elasticsearch::ruby { 'elasticsearch': }
###Package installation
There are 2 different ways of installing the software
####Repository
This option allows you to use an existing repository for package installation.
The repo_version
corresponds with the major version of Elasticsearch.
class { 'elasticsearch':
manage_repo => true,
repo_version => '1.2',
}
####Remote package source
When a repository is not available or preferred you can install the packages from a remote source:
#####http/https/ftp
class { 'elasticsearch':
package_url => 'https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.2.1.deb'
}
#####puppet://
class { 'elasticsearch':
package_url => 'puppet:///path/to/elasticsearch-1.2.1.deb'
}
#####Local file
class { 'elasticsearch':
package_url => 'file:/path/to/elasticsearch-1.2.1.deb'
}
###Java installation
Most sites will manage Java separately; however, this module can attempt to install Java as well.
class { 'elasticsearch':
java_install => true
}
Specify a particular Java package/version to be installed:
class { 'elasticsearch':
java_install => true,
java_package => 'packagename'
}
###Service management
Currently only the basic SysV-style init and Systemd service providers are supported, but other systems could be implemented as necessary (pull requests welcome).
####Defaults File
The defaults file (/etc/defaults/elasticsearch
or /etc/sysconfig/elasticsearch
) for the Elasticsearch service can be populated as necessary. This can either be a static file resource or a simple key value-style hash object, the latter being particularly well-suited to pulling out of a data source such as Hiera.
#####file source
class { 'elasticsearch':
init_defaults_file => 'puppet:///path/to/defaults'
}
#####hash representation
$config_hash = {
'ES_USER' => 'elasticsearch',
'ES_GROUP' => 'elasticsearch',
}
class { 'elasticsearch':
init_defaults => $config_hash
}
Note: init_defaults
hash can be passed to the main class and to the instance.
##Advanced features
###Data directories
There are 4 different ways of setting data directories for Elasticsearch.
In every case the required configuration options are placed in the elasticsearch.yml
file.
####Default By default we use:
/usr/share/elasticsearch/data/$instance_name
Which provides a data directory per instance.
####Single global data directory
class { 'elasticsearch':
datadir => '/var/lib/elasticsearch-data'
}
Creates the following for each instance:
/var/lib/elasticsearch-data/$instance_name
####Multiple Global data directories
class { 'elasticsearch:
datadir => [ '/var/lib/es-data1', '/var/lib/es-data2']
}
Creates the following for each instance:
/var/lib/es-data1/$instance_name
and
/var/lib/es-data2/$instance_name
####Single instance data directory
class { 'elasticsearch': }
elasticsearch::instance { 'es-01':
datadir => '/var/lib/es-data-es01'
}
Creates the following for this instance:
/var/lib/es-data-es01
####Multiple instance data directories
class { 'elasticsearch': }
elasticsearch::instance { 'es-01':
datadir => ['/var/lib/es-data1-es01', '/var/lib/es-data2-es01']
}
Creates the following for this instance:
/var/lib/es-data1-es01
and
/var/lib/es-data2-es01
###Main and instance configurations
The config
option in both the main class and the instances can be configured to work together.
The options in the instance
config hash will merged with the ones from the main class and override any duplicates.
Simple merging
class { 'elasticsearch':
config => { 'cluster.name' => 'clustername' }
}
elasticsearch::instance { 'es-01':
config => { 'node.name' => 'nodename' }
}
elasticsearch::instance { 'es-02':
config => { 'node.name' => 'nodename2' }
}
This example merges the cluster.name
together with the node.name
option.
Overriding
When duplicate options are provided, the option in the instance config overrides the ones from the main class.
class { 'elasticsearch':
config => { 'cluster.name' => 'clustername' }
}
elasticsearch::instance { 'es-01':
config => { 'node.name' => 'nodename', 'cluster.name' => 'otherclustername' }
}
elasticsearch::instance { 'es-02':
config => { 'node.name' => 'nodename2' }
}
This will set the cluster name to otherclustername
for the instance es-01
but will keep it to clustername
for instance es-02
####Configuration writeup
The config
hash can be written in 2 different ways:
Full hash writeup
Instead of writing the full hash representation:
class { 'elasticsearch':
config => {
'cluster' => {
'name' => 'ClusterName',
'routing' => {
'allocation' => {
'awareness' => {
'attributes' => 'rack'
}
}
}
}
}
}
Short hash writeu
class { 'elasticsearch':
config => {
'cluster' => {
'name' => 'ClusterName',
'routing.allocation.awareness.attributes' => 'rack'
}
}
}
##Limitations
This module has been built on and tested against Puppet 2.7 and higher.
The module has been tested on:
- Debian 6/7
- CentOS 6
- Ubuntu 12.04, 13.x, 14.x
- OpenSuSE 12.x
Testing on other platforms has been light and cannot be guaranteed.
##Development
##Support
Need help? Join us in #elasticsearch on Freenode IRC or subscribe to the elasticsearch@googlegroups.com mailing list.
##0.4.0 ( Jun 18, 2014 ) - Backwards compatible breaking release
###Summary This release introduces instances to facilitate the option to have more then a single instance running on the host system.
####Features
- Rewrite module to incorperate multi instance support
- New readme layout
####Bugfixes
- None
####Changes
- Adding ec2-linux osfamily for repo management
- Retry behaviour for plugin installation
####Testing changes
- Adding Puppet 3.6.x testing
- Ubuntu 14.04 testing
- Using new docker images
- Pin rspec to 2.14.x
####Known Bugs
- No known bugs
##0.3.2 ( May 15, 2014 )
- Add support for SLC/Scientific Linux CERN ( PR #121 )
- Add support for custom package names ( PR #122 )
- Fix python and ruby client defines to avoid name clashes.
- Add ability to use stage instead of anchor for repo class
- Minor fixes to system tests
##0.3.1 ( April 22, 2014 )
- Ensure we create the plugin directory before installing plugins
- Added Puppet 3.5.x to rspec and system tests
##0.3.0 ( April 2, 2014 )
- Fix minor issue with yumrepo in repo class ( PR #92 )
- Implement OpenSuse support
- Implement Junit reporting for tests
- Adding more system tests and convert to Docker images
- Use Augeas for managing the defaults file
- Add retry to package download exec
- Add management to manage the logging.yml file
- Improve inline documentation
- Improve support for Debian 6
- Improve augeas for values with spaces
- Run plugin install as ES user ( PR #108 )
- Fix rights for the plugin directory
- Pin Rake for Ruby 1.8.7
- Adding new metadata for Forge.
- Increase time for retry to insert the template
##0.2.4 ( Feb 21, 2014 )
- Set puppetlabs-stdlib dependency version from 3.0.0 to 3.2.0 to be inline with other modules
- Let puppet run fail when template insert fails
- Documentation improvements ( PR #77, #78, #83 )
- Added beaker system tests
- Fixed template define after failing system tests
- Some fixes so variables are more inline with intended structure
##0.2.3 ( Feb 06, 2014 )
- Add repository management feature
- Improve testing coverage and implement basic resource coverage reporting
- Add puppet 3.4.x testing
- Fix dependency in template define ( PR #72 )
- For apt repo change from key server to key file
##0.2.2 ( Jan 23, 2014 )
- Ensure exec names are unique. This caused issues when using our logstash module
- Add spec tests for plugin define
##0.2.1 ( Jan 22, 2014 )
- Simplify the management of the defaults file ( PR #64 )
- Doc improvements for the plugin define ( PR #66 )
- Allow creation of data directory ( PR #68 )
- Fail early when package version and package_url are defined
##0.2.0 ( Nov 19, 2013 )
- Large rewrite of the entire module described below
- Make the core more dynamic for different service providers and multi instance capable
- Add better testing and devided into different files
- Fix template function. Replace of template is now only done when the file is changed
- Add different ways to install the package except from the repository ( puppet/http/https/ftp/file )
- Update java class to install openjdk 1.7
- Add tests for python function
- Update config file template to fix scoping issue ( from PR #57 )
- Add validation of templates
- Small changes for preperation for system tests
- Update readme for new functionality
- Added more test scenario's
- Added puppet parser validate task for added checking
- Ensure we don't add stuff when removing the module
- Update python client define
- Add ruby client define
- Add tests for ruby clients and update python client tests
##0.1.3 ( Sep 06, 2013 )
- Exec path settings has been updated to fix warnings ( PR #37, #47 )
- Adding define to install python bindings ( PR #43 )
- Scope deprecation fixes ( PR #41 )
- feature to install plugins ( PR #40 )
##0.1.2 ( Jun 21, 2013 )
- Update rake file to ignore the param inherit
- Added missing documentation to the template define
- Fix for template define to allow multiple templates ( PR #36 by Bruce Morrison )
##0.1.1 ( Jun 14, 2013 )
- Add Oracle Linux to the OS list ( PR #25 by Stas Alekseev )
- Respect the restart_on_change on the defaults ( PR #29 by Simon Effenberg )
- Make sure the config can be empty as advertised in the readme
- Remove dependency cycle when the defaults file is updated ( PR #31 by Bruce Morrison )
- Enable retry on the template insert in case ES isn't started yet ( PR #32 by Bruce Morrison )
- Update templates to avoid deprecation notice with Puppet 3.2.x
- Update template define to avoid auto insert issue with ES
- Update spec tests to reflect changes to template define
##0.1.0 ( May 09, 2013 )
- Populate .gitignore ( PR #19 by Igor Galić )
- Add ability to install initfile ( PR #20 by Justin Lambert )
- Add ability to manage default file service parameters ( PR #21 by Mathieu Bornoz )
- Providing complete containment of the module ( PR #24 by Brian Lalor )
- Add ability to specify package version ( PR #25 by Justin Lambert )
- Adding license file
##0.0.7 ( Mar 23, 2013 )
- Ensure config directory is created and managed ( PR #13 by Martin Seener )
- Dont backup package if it changes
- Create explicit dependency on template directory ( PR #16 by Igor Galić )
- Make the config directory variable ( PR #17 by Igor Galić and PR #18 by Vincent Janelle )
- Fixing template define
##0.0.6 ( Mar 05, 2013 )
- Fixing issue with configuration not printing out arrays
- New feature to write the config hash shorter
- Updated readme to reflect the new feature
- Adding spec tests for config file generation
##0.0.5 ( Mar 03, 2013 )
- Option to disable restart on config file change ( PR #10 by Chris Boulton )
##0.0.4 ( Mar 02, 2013 )
- Fixed a major issue with the config template ( Issue #9 )
##0.0.3 ( Mar 02, 2013 )
- Adding spec tests
- Fixed init issue on Ubuntu ( Issue #6 by Marcus Furlong )
- Fixed config template problem ( Issue #8 by surfchris )
- New feature to manage templates
##0.0.2 ( Feb 16, 2013 )
- Feature to supply a package instead of being dependent on the repository
- Feature to install java in case one doesn't manage it externally
- Adding RedHat and Amazon as Operating systems
- fixed a typo - its a shard not a shared :) ( PR #5 by Martin Seener )
##0.0.1 ( Jan 13, 2013 )
- Initial release of the module
Dependencies
- puppetlabs/stdlib (>= 3.2.0)
Copyright (c) 2012-2014 Elasticsearch <http://www.elasticsearch.org> 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.