Puppet provisioning on Vagrant Error: –manifestdir

This post is a distilled version of the discussion here: https://github.com/mitchellh/vagrant/issues/3740

Problem:

When I started using the latest Puppetlabs boxes, I encountered the error “Error: Could not parse application options: invalid option: –manifestdir” when my puppet manifest was about to be executed.

Cause:

The error is thrown because most latest puppet boxes use Puppet4, which is called with a parameter it doesn’t know. So you’re executing a Puppet command on the guest box, which is (since your box upgrade) suddenly missing a mandatory “manifestdir” parameter.
From the lengthy thread mentioned above: The solution is still a work in progress.

In short: Vagrant calls puppet with –manifestdir, while newer boxes include a version of Puppet which no longer supports this parameter.

Solution:

Easiest: Add the box_version parameter to your Vagrantfile. This then uses an old Vagrant box where the manifestdir parameter is still valid. I used the box centos-6.6-64-puppet, which stopped working on version 1.0.2, so in my case:

config.vm.box = "puppetlabs/centos-6.6-64-puppet"
config.vm.box_version = "1.0.1"

Note: If you’re installing puppet via SHELL yourself in the box through apt-get or yum, then downgrade the version you are using to Puppet3

Better: Create your own puppet4 provisioner, like Hayden Ball has already done here: https://github.com/benh57/vagrant/tree/environments_wip/plugins/provisioners/puppet

Best: Upgrade your Vagrant version (Or wait until your distribution updates)  which doesn’t call Puppet with the suddenly non-existing parameter manifestdir
Currently, 2016-01-09, the latest stable versions still call Vagrant with the missing parameter.

To be complete; The error which is shown in your terminal:

==> jenkins: Error: Could not parse application options: invalid option: --manifestdir
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.


The whole log:


==> jenkins: Machine booted and ready!
==> jenkins: Checking for guest additions in VM...
 jenkins: The guest additions on this VM do not match the installed version of
 jenkins: VirtualBox! In most cases this is fine, but in rare cases it can
 jenkins: prevent things such as shared folders from working properly. If you see
 jenkins: shared folder errors, please make sure the guest additions within the
 jenkins: virtual machine match the version of VirtualBox you have installed on
 jenkins: your host and reload your VM.
 jenkins: 
 jenkins: Guest Additions Version: 4.3.22
 jenkins: VirtualBox Version: 5.0
==> jenkins: Mounting shared folders...
 jenkins: /vagrant => /home/joris/workspace/vagrant/multimachine
 jenkins: /tmp/vagrant-puppet/manifests-a11d1078b1b1f2e3bdea27312f6ba513 => /home/joris/workspace/vagrant/multimachine/manifests
==> jenkins: Running provisioner: puppet...
==> jenkins: Running Puppet with default.pp...
==> jenkins: Error: Could not parse application options: invalid option: --manifestdir
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.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s