This is probably just a basic question, but I can't find a solution. I set up an environment where I want to use the apache module given by puppetlabs.
My puppet version is 3.7.2
tree of my directory:
.
├── environments
│ └── test
│ ├── environment.conf
│ ├── manifests
│ │ └── site.pp
│ └── modules
│ ├── apache
│ │ └── manifests
│ │ ├── init.pp
│ │ └── vhost_basic.pp
│ └── update
│ └── manifests
│ └── init.pp
└── Vagrantfile
my provisioner inside Vagrantfile looks like this:
config.vm.provision :puppet do |puppet|
puppet.environment_path = "environments"
puppet.environment = "test"
puppet.options = ['--verbose']
end
my site.pp:
Exec { path => [ "/bin/", "/sbin/" , "/usr/bin/", "/usr/sbin/" ] }
include update
node 'localhost' {
class { 'apache': } # use apache module
apache::vhost { 'example.com': # define vhost resource
port => '80',
docroot => '/var/www/html'
}
}
inside the apaches (directory) init.pp I only have include apache. And I installed the apache module via puppet module install puppetlabs-apache. And it's also stored in home/user/.puppet/modules. I also installed the module via sudo (since I read somewhere that it makes a difference..). But when I run vagrant provision it says me:
==> default: Running provisioner: puppet...
==> default: Running Puppet with environment test...
==> default: Error: Evaluation Error: Error while evaluating a Resource Statement, Could not find declared class apache at /tmp/vagrant-puppet/environments/test/manifests/site.pp:16:3 on node localhost
What am I missing here?
EDIT:
the result of puppet config print |grep path is:
path = none
environmentpath =
basemodulepath = /home/user/.puppet/modules:/usr/share/puppet/modules
modulepath = /home/user/.puppet/modules:/usr/share/puppet/modules
factpath = /home/user/.puppet/var/lib/facter:/home/user/.puppet/var/facts
modulepathin yourenvironment.conf? - Frederic Henriconfig.vm.hostname = "localhost"gives the same result - user3528269environment.conflooks like this:modulepath = ./modules:$basemodulepath:/etc/puppet/modules, there is also the module apache. If I remove this file, it has the same result. - user3528269