【问题标题】:Install mysql with puppet on vagrant vm在 vagrant vm 上安装带有 puppet 的 mysql
【发布时间】:2015-05-09 17:15:51
【问题描述】:

我正在尝试在带有 puppet 的 vagrant 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.

【问题讨论】:

    标签: mysql vagrant puppet


    【解决方案1】:

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

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

    【讨论】:

    • 我必须在主机的guest中安装puppet module install --modulepath modules puppetlabs-mysql??
    • 您想在创建虚拟机之前在主机上执行此操作,但如果您稍后执行此操作,您可以随时运行vagrant provision 重新执行 puppet 应用,
    猜你喜欢
    • 1970-01-01
    • 2013-10-24
    • 1970-01-01
    • 1970-01-01
    • 2014-03-02
    • 2015-11-20
    • 1970-01-01
    • 1970-01-01
    • 2015-01-25
    相关资源
    最近更新 更多