ypereirareis/vagrant-elasticsearch-cluster — pull request #3 by jubianchi (2014-03-26 21:02:44+00:00)
Title: Move VMs management back to vagrant

The Vagrantfile now allows vagrant to work with a variable number of VMs.
This make the `scripts/vagrant-elasticsearch-cluster` as vagrant can handle everything.

The VMs configuration has been moved to a loop in the Vagrantfile, allowing us to use the exact same configuration for each node without duplication.

The user can change the cluster's size using the `CLUSTER_COUNT` variable. The provided value will be cached in the `.vagrant` directory so we don't have to repeat its value on each command.

The native vagrant commands are used to manage the cluster.

I think this PR closes some TODO items :
* [ ] Add a bash command to stop a specific node in the cluster : we can now use `vagrant halt ` to stop an instance
* [ ] Add a bash command to add a new node in the cluster : we can dynamically resize the cluster by overriding the `CLUSTER_COUNT`variable after the first launch :

```sh
$ CLUSTER_COUNT=2 vagrant up
Bringing machine 'vm1' up with 'virtualbox' provider...
Bringing machine 'vm2' up with 'virtualbox' provider...
# ...

$ vagrant status
Current machine states:

vm1 running (virtualbox)
vm2 running (virtualbox)

$ CLUSTER_COUNT=3 vagrant up
Bringing machine 'vm1' up with 'virtualbox' provider...
Bringing machine 'vm2' up with 'virtualbox' provider...
Bringing machine 'vm3' up with 'virtualbox' provider...
==> vm1: VirtualBox VM is already running.
==> vm2: VirtualBox VM is already running.
==> vm3: Importing base box 'ypereirareis/debian-elasticsearch-amd64'...
==> vm3: Matching MAC address for NAT networking...
==> vm3: Checking if box 'ypereirareis/debian-elasticsearch-amd64' is up to date...
# ...

$ vagrant status
Current machine states:

vm1 running (virtualbox)
vm2 running (virtualbox)
vm3 running (virtualbox)
```
* [ ] Add a bash command to restart a specicif node : we can now use `vagrant reload `