2015-05-09 147 views
1

我试图与木偶颠沛流离的虚拟机上安装了MySQL服务器和木偶安装MySQL,我已经添加了对流浪此行文件对流浪汉VM

config.vm.provision "puppet" 

在同一个文件夹Vagrantfile我已经创建文件夹的清单和它里面的文件夹是default.pp与此内容

class { '::mysql::server': 
    root_password   => 'root', 
    remove_default_accounts => false, 
    override_options  => $override_options 
} 
mysql::db { 'wordpress': 
    user  => 'wordpress', 
    password => '12345', 
    host  => 'localhost', 
    grant => ['ALL'], 
} 

但是,当我执行vagrant provision

==> default: Running provisioner: puppet... 
==> default: Running Puppet with default.pp... 
==> default: stdin: is not a tty 
==> default: Warning: Setting templatedir is deprecated. See http://links.puppetlabs.com/env-settings-deprecations 
==> default: (at /usr/lib/ruby/vendor_ruby/puppet/settings.rb:1139:in `issue_deprecation_warning') 
==> default: Error: Puppet::Parser::AST::Resource failed with error ArgumentError: Could not find declared class ::mysql::server at /tmp/vagrant-puppet/manifests-a11d1078b1b1f2e3bdea27312f6ba513/default.pp:5 on node vagrant-ubuntu-trusty-64.hitronhub.home 
==> default: Error: Puppet::Parser::AST::Resource failed with error ArgumentError: Could not find declared class ::mysql::server at /tmp/vagrant-puppet/manifests-a11d1078b1b1f2e3bdea27312f6ba513/default.pp:5 on node vagrant-ubuntu-trusty-64.hitronhub.home 
The SSH command responded with a non-zero exit status. Vagrant 
assumes that this means the command failed. The output for this command 
should be in the log above. Please read the output to determine what 
went wrong. 
我收到此错误信息210

回答

2

puppetlabs-mysql是一个puppet模块,这意味着它不包含在基础puppet可执行文件中。要使用它,你需要做的几件事情:

  1. 在项目中创建一个modules目录拿着木偶模块
  2. 使用puppet module install --modulepath modules puppetlabs-mysql MySQL的安装模块到模块目录
  3. Configure module_path for the puppet provisioner在你的流浪文件
+0

我必须在主机上安装'puppet module install --modulepath modules puppetlabs-mysql' in guest? – AFS

+0

你想在创建虚拟机之前在主机上完成它,但是如果你以后要做,你总是可以运行'vagrant provision'来重做puppet apply, –