forked from rtyler/instant-elasticsearch
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Vagrantfile
57 lines (47 loc) · 1.76 KB
/
Vagrantfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
ENV['VAGRANT_DEFAULT_PROVIDER'] = 'aws'
Vagrant.configure("2") do |config|
access_key_id = File.read('.vagrant_key_id').chomp
secret_access_key = File.read('.vagrant_secret_access_key').chomp
keypair = File.read('.vagrant_keypair_name').chomp
config.vm.box = 'dummy'
config.vm.provision 'puppet' do |pp|
pp.module_path = 'modules'
pp.manifest_file = 'vagrant.pp'
pp.facter = {
# Exposing these into Facter to allow the Elasticsearch cloud provisioner
# to use EC2 APIs to find the other nodes
:aws_access_key_id => access_key_id,
:aws_secret_key => secret_access_key
}
end
# Change this number up/down to create a bigger or smaller ES cluster
3.times do |number|
name = "elasticsearch#{number}"
config.vm.define(name) do |node|
node.vm.provider :aws do |aws, override|
aws.access_key_id = access_key_id
aws.secret_access_key = secret_access_key
aws.keypair_name = keypair
# Ensuring that our machines hostname is "correct" so Puppet will apply
# the right resources to it
aws.user_data = "#!/bin/sh
echo 'vagrant-#{name}' > /etc/hostname;
hostname 'vagrant-#{name}';"
# The `node_type` tag will be used in the Elasticsearch AWS plugin
# configuration to make sure that it only tries to connect to other
# Elasticsearch nodes
aws.tags = {
:node_type => 'elasticsearch',
:Name => name
}
# Ubuntu LTS 12.04 in us-west-2 with Puppet installed from the Puppet
# Labs apt repository
aws.ami = 'ami-665e3756'
aws.region = 'us-west-2'
override.ssh.username = "ubuntu"
override.ssh.private_key_path = File.expand_path('~/.ssh/id_rsa')
end
end
end
end
# vim: ft=ruby