# Adding Elasticsearch in Trellis

**URL:** https://discourse.roots.io/t/adding-elasticsearch-in-trellis/13397
**Category:** trellis
**Tags:** trellis
**Created:** 2018-08-21T16:01:06Z
**Posts:** 2

## Post 1 by @mine1044 — 2018-08-21T16:01:06Z

Hi everyone,

I am somewhat new to Trellis. Things are working smoothly so far, however, no matter how many different ways I configure it, I can’t seem to add the right options to dev.yml to make Elasticsearch work.

I’m using Elastic’s documentation to figure out the variables ([https://github.com/elastic/ansible-elasticsearch](https://github.com/elastic/ansible-elasticsearch)) I should add to dev.yml.

Here’s the role I added to dev.yml. This may be completely wrong, but it was the one that ran through without popping up an error after running vagrant reload --provision.

```
- { role: elastic.elasticsearch, es_api_basic_auth_username: elastic, es_api_basic_auth_password: changeme, discovery.zen.ping.unicast.hosts: "localhost:9301", hosts: "localhost", http.port: 9200, es_instance_name: example, tags: [elasticsearch, elastic] }
```

However, Elasticsearch is not listening at port 9200 (or any port.)

Your expert guidance is appreciated!

---

## Post 2 by @mine1044 — 2018-08-23T00:16:11Z

I figured it out. Being an Ansible/Vagrant/Trellis rookie didn’t help me.

Simply add this to requirements.yml:  
…

- name: elasticsearch  
src: geerlingguy.elasticsearch  
version: 2.2.0

And this role to dev.yml, or wherever you need it:  
…  
- { role: elasticsearch, tags: [elasticsearch] }

Run vagrant reload --provision

Finally, perform “Dance of Joy” for figuring this out on your own.
