Adding Elasticsearch in Trellis

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) 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!

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.

1 Like