blob: 61d656fa9776508a9370c9db673fce27c341fcea [file] [log] [blame]
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
hosts = [
{ hostname: "node1", ip: "192.168.66.101", memory: "2048", cpus: 2 },
{ hostname: "node2", ip: "192.168.66.102", memory: "2048", cpus: 2 },
{ hostname: "node3", ip: "192.168.66.103", memory: "2048", cpus: 2 },
{ hostname: "node4", ip: "192.168.66.104", memory: "2048", cpus: 2 }
]
Vagrant.configure(2) do |config|
# all hosts built on centos 6
config.vm.box = "bento/centos-6.7"
config.ssh.insert_key = false
# enable the hostmanager plugin
config.hostmanager.enabled = true
config.hostmanager.manage_host = true
# define each host
hosts.each_with_index do |host, index|
config.vm.define host[:hostname] do |node|
# host settings
node.vm.hostname = host[:hostname]
node.vm.network "private_network", ip: host[:ip]
# vm settings
node.vm.provider "virtualbox" do |vb|
vb.memory = host[:memory]
vb.cpus = host[:cpus]
end
# enable promisc mode on the network interface
if host.has_key?(:promisc)
vb.customize ["modifyvm", :id, "--nicpromisc#{host[:promisc]}", "allow-all"]
end
# provisioning; only after all hosts created
if index == hosts.size - 1
node.vm.provision :ansible do |ansible|
ansible.playbook = "../../playbooks/metron_full_install.yml"
ansible.sudo = true
ansible.inventory_path = "../../inventory/multinode-vagrant"
ansible.limit = "all"
end
end
end
end
end