使用 vagrant 和 puppet 配置静态 IP、网关等

使用 vagrant 和 puppet 配置静态 IP、网关等

我在用着http://forge.puppetlabs.com/razorsedge/network但我无法正确配置它。

这是我的 puppetfile.pp

class network {
    static { "eth1":
        ipaddress  => "1.2.3.248",
        netmask    => "255.255.255.128",
        ensure     => "up",
    }
}

node default {
    include eth1
}

但不起作用!

医生说

network::if::static { "eth0":
  ipaddress  => "1.2.3.248",
  netmask    => "255.255.255.128",
  ensure     => "up",
}

有人可以告诉我如何在 puppet 文件中翻译这个::吗?

谢谢!

答案1

我使用了这个 Vagrantfile

我设置了两张卡(一张是默认卡,另一张是公共卡),第一张使用我通常的配置,第二张使用自定义静态 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

相关内容