1. Installation steps. There are two ELK agents to install:

    • Metricbeat

      1. Copy the attached file metricbeat-6.0.0-x86_64.rpm to the target server
      2. Execute the command: sudo rpm -vi metricbeat-6.0.0-x86_64.rpm
      3. Copy the attached file system.yml to /etc/metricbeat/modules.d/
      4. Copy the attached file metricbeat.yml to /etc/metricbeat/
      5. Execute the command: sudo systemctl enable metricbeat
      6. Execute the command: sudo service metricbeat start
    • Filebeat

      1. Copy the attached file filebeat-6.0.0-x86_64.rpm to the target server
      2. Execute the command: sudo rpm -vi filebeat-6.0.0-x86_64.rpm
      3. Execute the command: sudo mv /etc/filebeat/module.d/system.yml.disabled /etc/filebeat/module.d/system.yml
      4. Copy the attached file filebeat.yml to /etc/filebeat/
      5. Execute the command: sudo systemctl enable filebeat
      6. Execute the command: sudo service filebeat start

I want to Automate this using Chef. The Chef environment is ready and working.I want to deploy this binaries on 150 servers. Would be helpfull if someone explain with step by step.

  • Elastic.co provides repositories IIRC, just use yum_repository and package resources, add a template or file resource for the service and configuration and you should be fine. (that's what I do for Ubuntu boxes)
    – Tensibai
    Feb 21 '18 at 19:02
  • Hey. Thank you. Could you please an example how you do or take my example as itself. Feb 21 '18 at 20:16

Very basic recipe exemple to install filebeat on ubuntu (I do use more or less the same approach for elasticsearch, kibana and logstash):

apt_repository 'elk' do
  uri 'https://artifacts.elastic.co/packages/5.x/apt'
  distribution 'stable'
  components ['main']
  key 'https://artifacts.elastic.co/GPG-KEY-elasticsearch'
  cache_rebuild true

package 'filebeat' do
  action :upgrade # To keep up to date with releases from elastic.co

service 'filebeat' do
  action [:enable, :start]

template '/etc/filebeat/filebeat.yml' do
  source 'filebeat.yml.erb'
  mode '0600'
  notifies :restart, 'service[filebeat]'

Basically, adding a repository, installing package, enabling and starting the service, render a config and restart the service when it changes. On ubuntu the package set the service scripts so I don't have to manage it here.

The template is my default configuration using some node attributes depending on environment. See https://docs.chef.io/resource_template.html for more details on how to use them.

According to your question I would strongly sugest you to follow the tutorial paths at https://learn.chef.io to grasp the basics about chef.

  • 1
    Sure.. I will do that. Feb 23 '18 at 17:03






The latter provides code snippets, like how to copy files:

Create a file from a copy

The following example shows how to copy a file from one directory to another, locally on a node:

file '/root/1.txt' do
  content IO.read('/tmp/1.txt')
  action :create

More example could be found in the supermarket. In order to write chef books one could investigate how some recipes are structured like mysql.

  • Hey.Thank you.I want to know how to proceed.What I understood from the answer is. The above snippets creates a package after that I have to prepare a recipe? Feb 21 '18 at 19:24
  • Could you explain why you would like to use chef?
    – 030
    Feb 21 '18 at 20:27
  • I am using it for deployment of the above binaries for all servers Feb 21 '18 at 20:46
  • Ok, but did you consider puppet, ansible or salt?
    – 030
    Feb 21 '18 at 20:47
  • Hey. I already have an environment of chef Feb 21 '18 at 20:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.