Created
December 16, 2016 19:17
-
-
Save pj/3db0fe2e87cf35d4f6ffb37a5b5b8bb6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
Vagrant.configure("2") do |config| | |
# Define our MAAS instance | |
config.vm.define "controller", primary: true do |maas| | |
maas.vm.box = "bento/ubuntu-16.04" | |
maas.vm.hostname = "controller" | |
maas.vm.network :private_network, ip: '192.168.50.2' | |
maas.vm.network :forwarded_port, guest: 5240, host: 5240 | |
maas.vm.provider "virtualbox" do |vbox| | |
vbox.name = "controller" | |
vbox.customize ["modifyvm", :id, "--memory", "2048"] | |
vbox.customize ["modifyvm", :id, "--cableconnected1", "on"] | |
end | |
maas.vm.provision "shell", inline: <<-SCRIPT | |
sudo apt-get update | |
sudo apt-get install maas --assume-yes | |
sudo maas createadmin --username=maas --email=paul@johnson.kiwi.nz --password=maas | |
# enable dhcp | |
sudo maas-region apikey --username=maas > .maas_apikey | |
maas login maas http://localhost:5240/MAAS/api/2.1 - < .maas_apikey | |
maas maas vlan update fabric-2 untagged dhcp_on=True primary_rack=controller | |
SCRIPT | |
end | |
ENV['LC_ALL']="en_US.UTF-8" | |
config.vm.define "pxetest" do |pxe| | |
pxe.vm.box = "clink15/pxe" | |
pxe.vm.hostname = "pxetest" | |
#pxe.vm.network :private_network, type: 'dhcp' | |
pxe.vm.network :private_network, type: 'dhcp' | |
pxe.vm.provider "virtualbox" do |vbox| | |
vbox.name = "pxetest" | |
vbox.gui = true | |
vbox.customize ["modifyvm", :id, "--cableconnected1", "on"] | |
# Increase the boot priority of the second nic so PXE tries it instead | |
# of the NAT nic. | |
vbox.customize ["modifyvm", :id, "--nicbootprio2", "1"] | |
# TODO: Update this to run a command to extract the virtual network from | |
# the controller. Force the host only nic to use the same virtual | |
# network as the controller. | |
vbox.customize ["modifyvm", :id, "--hostonlyadapter2", "vboxnet0"] | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment