VAGRANTFILE_API_VERSION = "2" Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| config.vm.define "web", primary: true do |web| web.vm.box = "quantal64" web.vm.provider :lxc do |lxc| lxc.customize 'network.ipv4', '10.0.3.100/32' end end config.vm.define "db" do |db| db.vm.box = "quantal64" db.vm.provider :lxc do |lxc| lxc.customize 'network.ipv4', '10.0.3.101/32' end end end
FYI, versioning info:
vagrant -v Vagrant 1.3.3 vagrant plugin list vagrant-lxc (0.6.0)
If you use "config.vm.hostname", the ip will defined will be deleted.
ReplyDeleteThat is because setting the hostname makes:
comm.sudo("ifdown -a; ifup -a; ifup -a --allow=hotplug")
https://github.com/mitchellh/vagrant/blob/079a6edade732f13f42d266c8536d437a521154e/plugins/guests/ubuntu/cap/change_host_name.rb
And that command deletes our defined ip.
Another approach:
ReplyDeleteVagrantfile:
config.vm.provision "shell", inline: "/sbin/ip addr add 10.0.3.100/32 dev eth0"
vagrant provision puppetmaster --provision-with shell