【问题标题】:Could not find class at /tmp/vagrant-puppet在 /tmp/vagrant-puppet 找不到课程
【发布时间】:2019-10-09 17:46:21
【问题描述】:

我无法提供,我在其他线程中搜索但没有一个有用! 我在最新版本中使用 Vagrant 和 Puppet,我的项目结构是:

prova
|
|__Vagrantfile
|
|__puppet
        |__manifests
        |          |__ubonda.pp
        |
        |__modules
                 |
                 |__apache
                         |
                         |__manifests
                                    |
                                    |__apache.pp

我的 VagrantFile 是:

Vagrant.configure("2") do |config|
  config.vm.define "ubonda" do |vm0|
    vm0.vm.hostname = "ubonda"
    vm0.vm.box = "hashicorp/precise64"

    vm0.vm.provision "puppet" do |puppet|
      puppet.manifests_path = 'puppet/manifests'
      puppet.module_path = 'puppet/modules'
      puppet.manifest_file = "ubonda.pp"
    end
  end
end

我的 ubonda.pp 文件是:

# default path
Exec {
  path => ["/usr/bin", "/bin", "/usr/sbin", "/sbin", "/usr/local/bin", "/usr/local/sbin"]
}

include apache

我的 apache.pp 文件是:

class apache {

  # install apache
  package { "apache2":
  ensure => present,
  require => Exec["apt-get update"]
  }

  # ensures that mode_rewrite is loaded and modifies the default configuration file
  file { "/etc/apache2/mods-enabled/rewrite.load":
  ensure => link,
  target => "/etc/apache2/mods-available/rewrite.load",
  require => Package["apache2"]
  }

  # create directory
  file {"/etc/apache2/sites-enabled":
  ensure => directory,
  recurse => true,
  purge => true,
  force => true,
  before => File["/etc/apache2/sites-enabled/vagrant_webroot"],
  require => Package["apache2"],...
  }
}

如果我启动vagrant provision,我会得到:

==> ubonda: Running provisioner: puppet...
==> ubonda: Running Puppet with ubonda.pp...
==> ubonda: warning: Could not retrieve fact fqdn
==> ubonda: Could not find class apache for ubonda at /tmp/vagrant-puppet/manifests-846018e2aa141a5eb79a64b4015fc5f3/ubonda.pp:6 on node ubonda

我在ubonda vm的tmp/manifests文件夹中搜索,里面只有ubonda.pp,而在tmp/modules中有apache但两者没有连接,所以我试图在清单里面复制,但是什么都没有改变,我该怎么办?

【问题讨论】:

    标签: ruby vagrant puppet


    【解决方案1】:

    解决方案非常简单,但我将问题留给后人。 包含 puppet 规范的文件必须命名为 init.pp 才能正确识别

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-10-24
      • 2013-01-27
      • 1970-01-01
      • 2017-01-20
      • 1970-01-01
      • 2014-09-29
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多