Configuring a static IP, gateway etc with vagrant and puppet
5,919
I worked around with this Vagrantfile
I setup two cards (the default one and a second public one) the first with my usual conf and the second with a custom static IP
Vagrant.configure("2") do |config|
config.vm.box = "precise32"
config.vm.provider :virtualbox do |v|
v.customize ["modifyvm", :id, "--memory", 256]
v.customize ["modifyvm", :id, "--nictype1", "virtio"] # the main card (used for ssh and internal networking between host and guest)
v.customize ["modifyvm", :id, "--nictype2", "virtio"] # a second card
v.gui = true # for debug
end
config.vm.network :bridged, :bridge => "en0: Wi-Fi (Airport)", :adapter => 1 # the main card configuration
config.vm.network :private_network, :ip => "192.168.2.100", :nictype => 'virtio', :adapter => 2 # the secondary card configuration with a static IP
end
Related videos on Youtube
Author by
Antonello Pasella
Updated on September 18, 2022Comments
-
Antonello Pasella over 1 year
I'm using http://forge.puppetlabs.com/razorsedge/network but I can't configure it properly.
this is my puppetfile.pp
class network { static { "eth1": ipaddress => "1.2.3.248", netmask => "255.255.255.128", ensure => "up", } } node default { include eth1 }
But won't work!
The doc says
network::if::static { "eth0": ipaddress => "1.2.3.248", netmask => "255.255.255.128", ensure => "up", }
may someone point me how to trnslate this :: in a puppet file?
Thanks!
-
user9517 about 11 yearsWould you mind explaining how this solved the problem please.
-
Antonello Pasella about 11 yearsYou're right. This won't solve, it's a workaroud. Edited
-
user9517 about 11 yearsWhat I meant was can you explain a little what it does / why it helps, the bare link doesn't really do that.