Search code examples
vagrantpuppetvagrant-windowsvagrant-provision

Could not find class when running puppet module during Vagrant deploy


I'm looking to deploy a CentOS 7 VirtualBox VM by Vagrant 1.9.5 and I want to run some puppet modules deployed locally.

Below my Vagrantfile:

Vagrant.configure("2") do |config|
  config.vm.box = "centos/7"
  config.vm.hostname = "test01.virtual"         

  config.vm.provision :puppet do |puppet|
    puppet.manifests_path = "puppet/manifests"
    puppet.module_path = "puppet/modules/"
    puppet.options = ['--verbose']
  end
end

and my default.pp file under ./puppet/manifests:

Package { allow_virtual => true }

include mycode-dummy

Puppet module seems ok:

$ grep class puppet/modules/mycode-dummy/manifests/init.pp
class dummy($path    = '/tmp/dummy',

When I run vagrant up I receive the following error message:

....
==> default: Info: Loading facts
==> default: Error: Could not find class mycode-dummy for test01.virtual on node test01.virtual
==> default: Error: Could not find class mycode-dummy for test01.virtual on node test01.virtual
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.

It happens also with other modules and with other vagrant boxes.
I didn't catch was wrong...

BR
FleX


Solution

  • you're not calling the dummy class, you include a module but do not call anything from this module.

    In your default.pp you need to have something like

    Package { allow_virtual => true }
    
    class {dummy: }
    
    include dummy