# SRE-Ansible To Install ELK Stack

**URL:** <https://discuss.elastic.co/t/sre-ansible-to-install-elk-stack/274086>\
**Category:** Elasticsearch\
**Created:** [May 26, 2021, 3:12pm UTC](https://discuss.elastic.co/t/sre-ansible-to-install-elk-stack/274086 "2021-05-26T15:12:08Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ashish\_Jindal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ashish_jindal/32/46023_2.png) [@Ashish\_Jindal](https://discuss.elastic.co/u/Ashish_Jindal)\
**Post date:** [May 26, 2021, 3:12pm UTC](https://discuss.elastic.co/t/sre-ansible-to-install-elk-stack/274086/1 "2021-05-26T15:12:08Z")

</div>

Our task is related to SRE-Ansible To Install ELK Stack i.e.

Write an ansible script to install ELK stack and filebeat locally. To do so, create a directory structure as mentioned below

```auto
 ansible_ELK 
  |_site.yml 
  |_roles 
    |_elasticsearch 
      |_tasks
        |_main.yml   
    |_logstash 
      |_tasks
        |_main.yml
    |_kibana
      |_tasks
        |_main.yml
    |_filebeat
      |_tasks
        |_main.yml

```

For creating we are using

```auto
git clone https://github.com/jekhokie/scriptbox.git
cd scriptbox/ansible--elk-stack/

```

 ![ELK](https://us1.discourse-cdn.com/elastic/original/3X/f/c/fcd01959d511ddef25f5b8231fb1be82367f0789.jpeg)

Please provide expertise advice anything wrong here as above command command showing incorrect result.

---

<div class="post-metadata">

**Author:** ![Ashish\_Jindal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ashish_jindal/32/46023_2.png) [@Ashish\_Jindal](https://discuss.elastic.co/u/Ashish_Jindal)\
**Post date:** [May 27, 2021, 7:49am UTC](https://discuss.elastic.co/t/sre-ansible-to-install-elk-stack/274086/2 "2021-05-27T07:49:16Z")

</div>

any expertise advice?

---

<div class="post-metadata">

**Author:** ![Sreekanth\_Ragi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sreekanth_ragi/32/58498_2.png) [@Sreekanth\_Ragi](https://discuss.elastic.co/u/Sreekanth_Ragi)\
**Post date:** [May 28, 2021, 6:57am UTC](https://discuss.elastic.co/t/sre-ansible-to-install-elk-stack/274086/3 "2021-05-28T06:57:49Z")

</div>

> [@Ashish\_Jindal](#):
>
> ```auto
> roles 
> |_elasticsearch 
> |_tasks
> |_main.yml   
> |_logstash 
> |_tasks
> |_main.yml
> |_kibana
> |_tasks
> |_main.yml
> |_filebeat
> 
> ```

Hi Ashish,

The structure looks ok, but you may also create a common role to install common components like JAVA, setting JAVA HOME and also for any kernel level parameters that are common to all the three components.

Not sure if you planned for this, but since it is not depicted in the structure, you could also include elasticsearch.yml.j2, kibana.yml.j2 as template files. Same thing with filebeat.yml too.

---

<div class="post-metadata">

**Author:** ![Ashish\_Jindal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ashish_jindal/32/46023_2.png) [@Ashish\_Jindal](https://discuss.elastic.co/u/Ashish_Jindal)\
**Post date:** [May 28, 2021, 6:59am UTC](https://discuss.elastic.co/t/sre-ansible-to-install-elk-stack/274086/4 "2021-05-28T06:59:25Z")

</div>

can cannot use

git clone [https://github.com/jekhokie/scriptbox.git](https://github.com/jekhokie/scriptbox.git)

---

<div class="post-metadata">

**Author:** ![Sreekanth\_Ragi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sreekanth_ragi/32/58498_2.png) [@Sreekanth\_Ragi](https://discuss.elastic.co/u/Sreekanth_Ragi)\
**Post date:** [May 28, 2021, 7:30am UTC](https://discuss.elastic.co/t/sre-ansible-to-install-elk-stack/274086/5 "2021-05-28T07:30:03Z")

</div>

Absolutely, no point re-inventing the wheel, please use if it suits your requirement.

---

<div class="post-metadata">

**Author:** ![Ashish\_Jindal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ashish_jindal/32/46023_2.png) [@Ashish\_Jindal](https://discuss.elastic.co/u/Ashish_Jindal)\
**Post date:** [May 28, 2021, 8:13am UTC](https://discuss.elastic.co/t/sre-ansible-to-install-elk-stack/274086/6 "2021-05-28T08:13:24Z")

</div>

what will be script fot "Write an ansible script to install ELK stack and filebeat locally. "

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [June 25, 2021, 8:14am UTC](https://discuss.elastic.co/t/sre-ansible-to-install-elk-stack/274086/7 "2021-06-25T08:14:15Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
