-
Notifications
You must be signed in to change notification settings - Fork 1
/
VagrantFile
70 lines (56 loc) · 2.32 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
58
59
60
61
62
63
64
65
66
67
68
69
70
# -*- mode: ruby -*-
# vi: set ft=ruby :
ANSIBLE_PATH = __dir__
require 'yaml'
vconfig = YAML.load_file("#{ANSIBLE_PATH}/vagrant.default.yml")
Vagrant.configure("2") do |config|
config.vm.define "prometheus" do |prometheus|
prometheus.vm.box = vconfig.fetch('vagrant_box')
# Fix for: "stdin: is not a tty"
# https://github.com/mitchellh/vagrant/issues/1673#issuecomment-28288042
prometheus.ssh.shell = %{bash -c 'BASH_ENV=/etc/profile exec bash'}
prometheus.vm.provider "virtualbox" do |vb|
vb.name = vconfig.fetch('vagrant_prometheus_hostname')
vb.cpus = vconfig.fetch('vagrant_cpus')
vb.memory = vconfig.fetch('vagrant_memory')
vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
vb.customize ["modifyvm", :id, "--ioapic", "on"]
end
prometheus.vm.network :private_network, ip: vconfig.fetch('vagrant_prometheus_ip')
prometheus.vm.hostname = vconfig.fetch('vagrant_prometheus_hostname')
end
config.vm.define "node" do |node|
node.vm.box = vconfig.fetch('vagrant_box')
# Fix for: "stdin: is not a tty"
# https://github.com/mitchellh/vagrant/issues/1673#issuecomment-28288042
node.ssh.shell = %{bash -c 'BASH_ENV=/etc/profile exec bash'}
node.vm.provider "virtualbox" do |vb|
vb.name = vconfig.fetch('vagrant_node_hostname')
vb.cpus = vconfig.fetch('vagrant_cpus')
vb.memory = vconfig.fetch('vagrant_memory')
vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
vb.customize ["modifyvm", :id, "--ioapic", "on"]
end
node.vm.network :private_network, ip: vconfig.fetch('vagrant_node_ip')
node.vm.hostname = vconfig.fetch('vagrant_node_hostname')
end
config.vm.provision "shell" do |s|
s.inline = "apt install -y python"
end
config.vm.provision :ansible do |ansible|
ansible.verbose = "v"
ansible.playbook = "playbook.yml"
ansible.sudo = true
ansible.groups = {
'development' => ['prometheus', 'node'],
'prometheus' => ['prometheus'],
'node' => ['prometheus', 'node']
}
end
if Vagrant.has_plugin?('vagrant-hostmanager')
config.hostmanager.enabled = true
config.hostmanager.manage_host = true
else
fail_with_message "vagrant-hostmanager missing, please install the plugin with this command:\nvagrant plugin install vagrant-hostmanager"
end
end