comperiosearch/vagrant-elk-box-ansible

How to start elasticsearch service automatically after restarting the vagrant box?

Opened this issue · 1 comments

I do the following steps in the playbook:


---

- hosts: master
  sudo: true
  tags: elasticsearch
  roles:
    - ansible-elasticsearch

And then vagrant up es-test-cluster, where es-test-cluster is the name of the VM I mention in VagrantFile. I have given it a private IP 192.162.12.14. The VM boot perfectly and after running sudo service elasticsearch status I get that the service is running on 192.162.12.14:9200 which is correct. But if I run vagrant halt es-test-cluster and then vagrant up es-test-cluster I see that the elasticsearch service is running any more.

I thought of doing this:


---

- hosts: master
  sudo: true
  tags: elasticsearch
  roles:
    - ansible-elasticsearch
  tasks:
  - name: Starting elasticsearch service if not running
    service: name=elasticsearch state=started

but even this does not help. This only runs when I boot for the first time.

How can start the service whenever I run vagrant up?

I had the same problem, while I couldn't bring it up automatically, you can it bring back up manually by doing the following:

$ sudo /etc/init.d/elasticsearch start