{"id":27623080,"url":"https://github.com/elastic/cookbook-elasticsearch","last_synced_at":"2025-04-23T10:01:54.782Z","repository":{"id":2023312,"uuid":"2959446","full_name":"sous-chefs/elasticsearch","owner":"sous-chefs","description":"Development repository for the elasticsearch cookbook","archived":false,"fork":false,"pushed_at":"2024-11-18T18:34:10.000Z","size":22693,"stargazers_count":881,"open_issues_count":23,"forks_count":598,"subscribers_count":337,"default_branch":"main","last_synced_at":"2025-04-21T02:27:23.410Z","etag":null,"topics":["chef","chef-cookbook","chef-resource","elasticsearch","hacktoberfest","managed-by-terraform"],"latest_commit_sha":null,"homepage":"https://supermarket.chef.io/cookbooks/elasticsearch","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sous-chefs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"open_collective":"sous-chefs"}},"created_at":"2011-12-11T18:36:45.000Z","updated_at":"2025-03-29T21:16:53.000Z","dependencies_parsed_at":"2023-07-06T09:01:48.424Z","dependency_job_id":"d80765a9-646b-4d84-9960-5760f3ed4ed7","html_url":"https://github.com/sous-chefs/elasticsearch","commit_stats":{"total_commits":430,"total_committers":57,"mean_commits":7.543859649122807,"dds":0.5232558139534884,"last_synced_commit":"92b4e0990bccf2354f53cefc7b171964d2fa4e65"},"previous_names":["sous-chefs/cookbook-elasticsearch","elastic/cookbook-elasticsearch"],"tags_count":160,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sous-chefs%2Felasticsearch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sous-chefs%2Felasticsearch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sous-chefs%2Felasticsearch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sous-chefs%2Felasticsearch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sous-chefs","download_url":"https://codeload.github.com/sous-chefs/elasticsearch/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250412544,"owners_count":21426285,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chef","chef-cookbook","chef-resource","elasticsearch","hacktoberfest","managed-by-terraform"],"created_at":"2025-04-23T10:01:06.448Z","updated_at":"2025-04-23T10:01:54.750Z","avatar_url":"https://github.com/sous-chefs.png","language":"Ruby","funding_links":["https://opencollective.com/sous-chefs"],"categories":["Cookbooks","Ruby","Configuration Management","Elasticsearch"],"sub_categories":["Web Applications","Books"],"readme":"# Elasticsearch Chef Cookbook\n\n[![Cookbook Version](https://img.shields.io/cookbook/v/elasticsearch.svg)](https://supermarket.chef.io/cookbooks/elasticsearch)\n\n**Please** review the [frequently asked questions](FAQ.md) and [contributing guidelines](CONTRIBUTING.md) before opening issues or submitting pull requests.\n\n## Looking for Elasticsearch 5.x or 6.x?\n\nPlease [check out the previous 3.x.x releases](https://github.com/elastic/cookbook-elasticsearch/tree/3.x.x) of this cookbook. Please consider pinning your cookbook to '~\u003e 3.0' for support for Elasticsearch 6 and earlier, or '~\u003e 4.0' release for Elasticsearch 6 and beyond.\n\n## Resources\n\n## Notifications and Service Start/Restart\n\nThe resources provided in this cookbook **do not automatically restart** services when changes have occurred. They ***do start services by default when configuring a new service*** This has been done to protect you from accidental data loss and service outages, as nodes might restart simultaneously or may not restart at all when bad configuration values are supplied.\n\nelasticsearch_service has a special `service_actions` parameter you can use to specify what state the underlying service should be in on each chef run (defaults to `:enabled` and `:started`). It will also pass through all of the standard `service` resource\nactions to the underlying service resource if you wish to notify it.\n\nYou **must** supply your desired notifications when using each resource if you want Chef to automatically restart services. Again, we don't recommend this unless you know what you're doing.\n\n### Resource names\n\nMany of the resources provided in this cookbook need to share configuration\nvalues. For example, the `elasticsearch_service` resource needs to know the path\nto the configuration file(s) generated by `elasticsearch_configure` and the path\nto the actual ES binary installed by `elasticsearch_install`. And they both need\nto know the appropriate system user and group defined by `elasticsearch_user`.\n\nSearch order: In order to make this easy, all resources in this cookbook use the following\nsearch order to locate resources that apply to the same overall\nElasticsearch setup:\n\n1. Resources that share the same resource name\n1. Resources that share the same value for `instance_name`\n1. Resources named `default` or resources named `elasticsearch`\n   - This fails if both `default` and `elasticsearch` resources exist\n\nExamples of more complicated resource names are left to the reader, but here we\npresent a typical example that should work in most cases:\n\n```ruby\nelasticsearch_user 'elasticsearch'\nelasticsearch_install 'elasticsearch'\nelasticsearch_configure 'elasticsearch'\nelasticsearch_service 'elasticsearch'\nelasticsearch_plugin 'x-pack'\n```\n\n### elasticsearch_user\n\nActions: `:create`, `:remove`\n\nCreates a user and group on the system for use by elasticsearch. Here is an\nexample with many of the default options and default values (all options except\na resource name may be omitted).\n\nExamples:\n\n```ruby\nelasticsearch_user 'elasticsearch'\n```\n\n```ruby\nelasticsearch_user 'elasticsearch' do\n  username 'elasticsearch'\n  groupname 'elasticsearch'\n  shell '/bin/bash'\n  comment 'Elasticsearch User'\n\n  action :create\nend\n```\n\n### elasticsearch_install\n\nActions: `:install`, `:remove`\n\nDownloads the elasticsearch software, and unpacks it on the system. There are\ncurrently three ways to install -- `'repository'` (the default), which creates an\napt or yum repo and installs from there, `'package'`, which downloads the appropriate\npackage from elasticsearch.org and uses the package manager to install it, and\n`'tarball'` which downloads a tarball from elasticsearch.org and unpacks it.\nThis resource also comes with a `:remove` action which will remove the package\nor directory elasticsearch was unpacked into.\n\nYou may always specify a download_url and/or download_checksum, and you may\ninclude `%s` which will be replaced by the version parameter you supply.\n\nPlease be sure to consult the above attribute section as that controls how\nElasticsearch version, download URL and checksum are determined if you omit\nthem.\n\n**NOTE**: The `:remove` action has not been implemented yet. Pull requests are\nvery much welcome \u0026 encouraged, if you'd like to see this feature.\n\nExamples:\n\n```ruby\nelasticsearch_install 'elasticsearch'\n```\n\n```ruby\nelasticsearch_install 'my_es_installation' do\n  type 'package'\n  version '7.8.0'\n  action :install\nend\n```\n\n```ruby\nelasticsearch_install 'my_es_installation' do\n  type 'tarball'\n  dir '/usr/local' # where to install\n\n  download_url \"https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.7.2.tar.gz\"\n  # sha256\n  download_checksum \"6f81935e270c403681e120ec4395c28b2ddc87e659ff7784608b86beb5223dd2\"\n\n  action :install\nend\n```\n\n```ruby\nelasticsearch_install 'my_es_installation' do\n  type 'tarball'\n  version '7.8.0'\n  action :install # could be :remove as well\nend\n```\n\n```ruby\nelasticsearch_install 'my_es_installation' do\n  type 'package' # type of install\n  download_url \"https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.7.2.deb\"\n  # sha256\n  download_checksum \"791fb9f2131be2cf8c1f86ca35e0b912d7155a53f89c2df67467ca2105e77ec2\"\n  instance_name 'elasticsearch'\n  action :install # could be :remove as well\nend\n```\n\n### elasticsearch_configure\n\nActions: `:manage`, `:remove`\n\nConfigures an elasticsearch instance; creates directories for configuration,\nlogs, and data. Writes files `log4j2.properties`, `elasticsearch.in.sh` and\n`elasticsearch.yml`.\n\nThe main attribute for this resource is `configuration`,\nwhich is a hash of any elasticsearch configuration directives. The\nother important attribute is `default_configuration` -- this contains the\nminimal set of required defaults.\n\nNote that these are both *not* a Chef mash, everything must be in a single level\nof keys and values. Any settings you pass in configuration will be merged into\n(and potentially overwrite) any default settings.\n\nSee the examples, [as well as the attributes in the resource file](libraries/resource_configure.rb),\nfor more.\n\nExamples:\n\nWith all defaults -\n\n```ruby\nelasticsearch_configure 'elasticsearch'\n```\n\nWith mostly defaults -\n\n```ruby\nelasticsearch_configure 'elasticsearch' do\n    allocated_memory '512m'\n    configuration ({\n      'cluster.name' =\u003e 'escluster',\n      'node.name' =\u003e 'node01',\n      'http.port' =\u003e 9201\n    })\nend\n```\n\nVery complicated -\n\n```ruby\nelasticsearch_configure 'my_elasticsearch' do\n  # if you override one of these, you probably want to override all\n  path_home     \"/opt/elasticsearch\"\n  path_conf     \"/etc/opt/elasticsearch\"\n  path_data     \"/var/opt/elasticsearch\"\n  path_logs     \"/var/log/elasticsearch\"\n  path_pid      \"/var/run/elasticsearch\"\n  path_plugins  \"/opt/elasticsearch/plugins\"\n  path_bin      \"/opt/elasticsearch/bin\"\n\n  # override logging parameters\n  cookbook_log4j2_properties \"my_wrapper_cookbook\"\n  template_log4j2_properties \"my_log4j2.properties.erb\"\n\n  logging({:\"action\" =\u003e 'INFO'})\n\n  allocated_memory '123m'\n\n  jvm_options %w(\n                -XX:+UseParNewGC\n                -XX:+UseConcMarkSweepGC\n                -XX:CMSInitiatingOccupancyFraction=75\n                -XX:+UseCMSInitiatingOccupancyOnly\n                -XX:+HeapDumpOnOutOfMemoryError\n                -XX:+PrintGCDetails\n              )\n\n  configuration ({\n    'node.name' =\u003e 'crazy'\n  })\n\n  action :manage\nend\n```\n\n### elasticsearch_service\n\nActions: `:configure`, `:remove`\n\nWrites out a system service configuration of the appropriate type, and enables\nit to start on boot. You can override almost all of the relevant settings in\nsuch a way that you may run multiple instances. Most settings will be taken from\na matching `elasticsearch_config` resource in the collection.\n\n```ruby\nelasticsearch_service 'elasticsearch'\n```\n\nIf you'd like to skip init scripts and systemd scripts, simply pass `nil` for\nthe template file (init_source or systemd_source) and this cookbook will\nentirely skip trying to setup those scripts. Combined with changing the default\nservice actions, this will have the same effect as `action :nothing`.\n\n### elasticsearch_plugin\n\nActions: `:install`, `:remove`\n\nInstalls or removes a plugin to a given elasticsearch instance and plugin\ndirectory. Please note that there is currently no way to upgrade an existing\nplugin using commandline tools, so we haven't exposed that feature here either.\nFurthermore, there isn't a way to determine if a plugin is compatible with ES or\neven what version it is. So once we install a plugin to a directory, we\ngenerally assume that is the desired one and we don't touch it further.\n\nSee \u003chttps://github.com/elastic/cookbook-elasticsearch/issues/264\u003e for more info.\nNB: You [may encounter issues on certain distros](http://blog.backslasher.net/java-ssl-crash.html) with NSS 3.16.1 and OpenJDK 7.x.\n\nOfficially supported or commercial plugins require just the plugin name:\n\n```ruby\nelasticsearch_plugin 'analysis-icu' do\n  action :install\nend\nelasticsearch_plugin 'shield' do\n  action :install\nend\n```\n\nPlugins from GitHub require a URL of 'username/repository' or 'username/repository/version':\n\n```ruby\nelasticsearch_plugin 'kopf' do\n  url 'lmenezes/elasticsearch-kopf'\n  action :install\nend\n\nelasticsearch_plugin 'kopf' do\n  url 'lmenezes/elasticsearch-kopf/1.5.7'\n  action :install\nend\n```\n\nPlugins from Maven Central or Sonatype require 'groupId/artifactId/version':\n\n```ruby\nelasticsearch_plugin 'mapper-attachments' do\n  url 'org.elasticsearch/elasticsearch-mapper-attachments/2.6.0'\n  action :install\nend\n```\n\nPlugins can be installed from a custom URL or file location as follows:\n\n```ruby\nelasticsearch_plugin 'mapper-attachments' do\n  url 'http://some.domain.name//my-plugin-1.0.0.zip'\n  action :install\nend\n\nelasticsearch_plugin 'mapper-attachments' do\n  url 'file:/path/to/my-plugin-1.0.0.zip'\n  action :install\nend\n```\n\nThe plugin resource respects the `https_proxy` or `http_proxy` (non-SSL)\n[Chef settings](https://docs.chef.io/config_rb_client.html) unless explicitly\ndisabled using `chef_proxy false`:\n\n```ruby\nelasticsearch_plugin 'kopf' do\n  url 'lmenezes/elasticsearch-kopf'\n  chef_proxy false\n  action :install\nend\n```\n\nTo run multiple instances per machine, an explicit `plugin_dir` location\nhas to be provided:\n\n```ruby\nelasticsearch_plugin 'x-pack' do\n  plugin_dir '/usr/share/elasticsearch_foo/plugins'\nend\n```\n\nIf for some reason, you want to name the resource something else, you may\nprovide the true plugin name using the `plugin_name` parameter:\n\n```ruby\nelasticsearch_plugin 'xyzzy' do\n  plugin_name 'kopf'\n  url 'lmenezes/elasticsearch-kopf'\n  action :install\nend\n```\n\n## License\n\n```text\nThis software is licensed under the Apache 2 license, quoted below.\n\n    Copyright (c) 2015 Elasticsearch \u003chttps://www.elastic.co/\u003e\n\n    Licensed under the Apache License, Version 2.0 (the \"License\");\n    you may not use this file except in compliance with the License.\n    You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n    Unless required by applicable law or agreed to in writing, software\n    distributed under the License is distributed on an \"AS IS\" BASIS,\n    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n    See the License for the specific language governing permissions and\n    limitations under the License.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felastic%2Fcookbook-elasticsearch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felastic%2Fcookbook-elasticsearch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felastic%2Fcookbook-elasticsearch/lists"}