Search code examples
phpnginxvagrantpuppet

Vagrant with puppet, --manifestdir provision error


I wanted to start a small project to learn Vagrat and puppet so I created a DEbian VM with Vagrant.

The VM itself works fine the problem comes when I try to provision it with Puppet.

This is the error I get:

==> default: Running provisioner: puppet...
==> default: Running Puppet with default.pp...
==> default: stdin: is not a tty
==> default: 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.

This is my directory tree:

  • Vagrantfile

  • manifests

    • default.pp

Here is my Vagrantfile:

Vagrant.configure(2) do |config|
  config.vm.box = "puphpet/debian75-x64"

  config.vm.network "forwarded_port", guest: 80, host: 4527

  config.vm.provision :shell, :inline => "apt-get update --fix-missing"
  config.vm.provision "puppet" do |puppet|
    puppet.manifests_path = "manifests"
    puppet.manifest_file = "default.pp"
  end
end

And here is my puppet manifest:

exec { 'apt-update':
  command => '/usr/bin/apt-get update'
}

package { 'nginx':
  require => Exec['apt-update'],
  ensure => installed,
}

package { 'php5':
  require => Exec['apt-update'],
  ensure => installed,
}

package { 'redis-server':
  require => Exec['apt-update'],
  ensure => installed,
}

Im on a Ubuntu 15.10, VirtualBox 5.0.14 and Vagrant 1.7.4


Solution

  • The latest version of your box supports puppet 4.x and the manifest_dir is getting deprecated in puppet 4.x

    you can read also from vagrant doc

    If only environment and environments_path are specified, it will parse and use the manifest specified in the environment.conf file. If manifests_path and manifest_file is specified along with the environment options, the manifest from the environment will be overridden by the specified manifest_file. If manifests_path and manifest_file are specified without environments, the old non-environment mode will be used (which will fail on Puppet 4+).

    so you would need to:

    • Upgrade your puppet structure for support of puppet 4.x (migrate to directory environment)
    • or Downgrade the version of your box so puppet 3.x is installed