在vagrant vm上用puppet安装mysql

时间:2015-05-09 17:15:52

标签: mysql vagrant puppet

我试图在带有木偶的流浪者vm上安装mysql服务器,我已经在Vagrant文​​件中添加了这一行

config.vm.provision "puppet"

在同一个Vagrantfile文件夹中,我已经创建了manifests文件夹,在它的文件夹中,它的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.

1 个答案:

答案 0 :(得分:2)

puppetlabs-mysql是一个木偶模块,这意味着它不包含在基本木偶可执行文件中。要使用它,您需要做一些事情:

  1. 在项目中创建一个用于存放木偶模块的modules目录
  2. 使用puppet module install --modulepath modules puppetlabs-mysql将MySQL模块安装到模块目录
  3. 您的Vagrantfile中的
  4. Configure module_path for the puppet provisioner