Skip to content

Instantly share code, notes, and snippets.

@cinhtau
Last active May 2, 2018 09:45
Show Gist options
  • Save cinhtau/b44401f558628a4527b6455bab07fd2c to your computer and use it in GitHub Desktop.
Save cinhtau/b44401f558628a4527b6455bab07fd2c to your computer and use it in GitHub Desktop.
Ansible playbook to download Elasticsearch, Kibana and the commercial X-Pack extension. Usually needed for safe-guarded environments. The download could utilize checksum, but currently elastic provides `sha512` and ansible only `sha256` and `sha1`.
# Download playbook for Elasticsearch
---
- hosts: localhost
connection: local
vars:
version: 6.2.4
target_dir: /home/tan/downloads
elastic_base_url: https://artifacts.elastic.co/downloads
elasticsearch_file: "{{ elastic_base_url }}/elasticsearch/elasticsearch-{{version}}.tar.gz"
kibana_file: "{{ elastic_base_url }}/kibana/kibana-{{version}}-linux-x86_64.tar.gz"
logstash_file: "{{ elastic_base_url }}/logstash/logstash-{{version}}.tar.gz"
metricbeat_file: "{{ elastic_base_url }}/beats/metricbeat/metricbeat-{{version}}-linux-x86_64.tar.gz"
filebeat_file: "{{ elastic_base_url }}/beats/filebeat/filebeat-{{version}}-linux-x86_64.tar.gz"
packetbeat_file: "{{ elastic_base_url }}/beats/packetbeat/packetbeat-{{version}}-linux-x86_64.tar.gz"
xpack_file: "{{ elastic_base_url }}/packs/x-pack/x-pack-{{version}}.zip"
elasticsearch_target: "{{ target_dir }}/elasticsearch-{{version}}.tar.gz"
kibana_target: "{{ target_dir }}/kibana-{{version}}-linux-x86_64.tar.gz"
logstash_target: "{{ target_dir }}/logstash-{{version}}.tar.gz"
metricbeat_target: "{{ target_dir }}/metricbeat-{{version}}-linux-x86_64.tar.gz"
filebeat_target: "{{ target_dir }}/filebeat-{{version}}-linux-x86_64.tar.gz"
packetbeat_target: "{{ target_dir }}/packetbeat-{{version}}-linux-x86_64.tar.gz"
xpack_target: "{{ target_dir }}/xpack-{{version}}.zip"
gather_facts: False
tasks:
- name: Download Elasticsearch
get_url:
url: "{{ elasticsearch_file }}"
dest: "{{ elasticsearch_target }}"
mode: 0640
- name: Download Kibana
get_url:
url: "{{ kibana_file }}"
dest: "{{ kibana_target }}"
mode: 0640
- name: Download Logstash
get_url:
url: "{{ logstash_file }}"
dest: "{{ logstash_target }}"
mode: 0640
- name: Download X-Pack
get_url:
url: "{{ xpack_file }}"
dest: "{{ xpack_target }}"
mode: 0640
- name: Download Metricbeat
get_url:
url: "{{ metricbeat_file }}"
dest: "{{ metricbeat_target }}"
mode: 0640
- name: Download Filebeat
get_url:
url: "{{ filebeat_file }}"
dest: "{{ filebeat_target }}"
mode: 0640
- name: Download Packetbeat
get_url:
url: "{{ packetbeat_file }}"
dest: "{{ packetbeat_target }}"
mode: 0640
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment