2015-05-09 190 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, –