0
votes

I can't provision, i search in the other threads but no one is useful! I'm using Vagrant with Puppet both of them at the latest version, my project structure is:

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

My VagrantFile is:

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

My ubonda.pp file is:

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

include apache

My apache.pp file is:

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"],...
  }
}

If i launch vagrant provision i obtain :

==> 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

I search in the tmp/manifests folder of the ubonda vm and inside there is only the ubonda.pp while in the tmp/modules there is the apache but the two are not connected, so I tried to copy inside the manifest but nothing has changed, how can I do?

1

1 Answers

0
votes

The solution is very simple but I leave the question for posterity. The file containing the puppet specifications must be named as init.pp for it to be correctly recognized