I'm starting to dabble in vagrant provisioners besides the shell provisioner. In an attempt to get started with other provisioners, I took a shot at the Puppet Apply provisioner, which can be used without a master. I created a very basic Vagrantfile and a very basic default.pp file in the default location, but it seems to be getting tripped up on a module from Puppet Forge.
Specifically working with the nodejs module, I got the following error upon a vagrant up --provision
:
Bringing machine 'default' up with 'virtualbox' provider...==> default: Checking if box 'ubuntu/trusty64' version '20190514.0.0' is up to date...==> default: Running provisioner: puppet...==> default: Running Puppet with default.pp...==> default: Warning: Could not retrieve fact fqdn==> default: Warning: Host is missing hostname and/or domain: vagrant-ubuntu-trusty-64==> default: Error: Puppet::Parser::AST::Resource failed with error ArgumentError: Could not find declared class ::nodejs at /tmp/vagrant-puppet/manifests-###/default.pp:8 on node vagrant-ubuntu-trusty-64==> default: Wrapped exception:==> default: Could not find declared class ::nodejs==> default: Error: Puppet::Parser::AST::Resource failed with error ArgumentError: Could not find declared class ::nodejs at /tmp/vagrant-puppet/manifests-###/default.pp:8 on node vagrant-ubuntu-trusty-64The SSH command responded with a non-zero exit status. Vagrantassumes that this means the command failed. The output for this commandshould be in the log above. Please read the output to determine whatwent wrong.
At the time, my default.pp file looked like:
node default{ class { '::nodejs': manage_package_repo => false, nodejs_dev_package_ensure => 'present', npm_package_ensure => 'present', }}
My Vagrantfile looked like:
Vagrant.configure("2") do |config| config.vm.box = "ubuntu/trusty64" config.vm.provision "puppet"end
With that not working, I replaced the class with a simple include 'nodejs'
, inspired by this example which led to the following error:
Bringing machine 'default' up with 'virtualbox' provider...==> default: Checking if box 'ubuntu/trusty64' version '20190514.0.0' is up to date...==> default: Running provisioner: puppet...==> default: Running Puppet with default.pp...==> default: Warning: Could not retrieve fact fqdn==> default: Warning: Host is missing hostname and/or domain: vagrant-ubuntu-trusty-64==> default: Error: Could not find class nodejs for vagrant-ubuntu-trusty-64 on node vagrant-ubuntu-trusty-64==> default: Error: Could not find class nodejs for vagrant-ubuntu-trusty-64 on node vagrant-ubuntu-trusty-64The SSH command responded with a non-zero exit status. Vagrantassumes that this means the command failed. The output for this commandshould be in the log above. Please read the output to determine whatwent wrong.
Thinking back on it, I think the reason is I never got the chance to run puppet module install
for it, because Vagrant is handling the Puppet calls.
So is there some obvious flaw in my approach, am I missing something, or are remote modules not supported in Vagrant's Puppet provisioner? Since I'm newer to both Puppet and Vagrant, I wouldn't be surprised if the issue was on my end.