我已经为虚拟机克隆了一个模块 ,但是当我尝试将虚拟机应用到节点时,出现Error: Could not find a suitable provider for virt ,这是可以理解的,因为init.pp的内容指定了虚拟化内核应该已经在运行了(Xen或OpenVZ内核)。
然而,随着包括init.pp,我期望一个失败的消息运行puppet agent --test --debug节点上的debug:
class virt { fail "testfail" case $::virtual { /^xen/: { include virt::xen } #/^kvm/: { include virt::kvm } /^openvzhn/: { include virt::openvz } } }
但是,它与上面的错误失败, Error: Could not find a suitable provider for virt 。 我的节点定义:
node 'hostname' { # common is a custom module including SSH keys, works fine include common virt { "1001": memory => 1024, cpus => 4, tmpl_cache => "debian-6.0-x86_64", ensure => running, virt_type => "openvz" } }
在节点定义中,您不使用类virt,而是使用自定义typesvirt。
你可以在modulename / lib / puppet / type中find它。
它需要一个提供者,(modulename / lib / puppet / provider),但是找不到适合你的系统的。
要包含类 virt,您可以使用以下任一项:
包括virt或class('virt':}
它不工作的原因; 你可能会错过这些二进制文件之一:(从提供商处获取)
commands :virtinstall => "/usr/bin/virt-install" commands :virsh => "/usr/bin/virsh" commands :grep => "/bin/grep" commands :ip => "/sbin/ip"
那; 或者你没有这个:
confine :feature => :libvirt