Py_minion
Py_minion

Reputation: 2065

Vagrant puppet provision failure. Error msg: "The `puppet` binary appears not to be in the PATH of the guest. ... "

Vagrant puppet provision failure with ubuntu/xenial64.

Error message:

This could be because the PATH is not properly setup or perhaps Puppet is not installed on this guest. Puppet provisioning can not continue without Puppet properly installed.


Vagrantfile: Note: The below setup worked fine with ubuntu/trusty64

# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
  config.vm.box = "ubuntu/xenial64"
  config.vm.hostname = "elasticsearch-learn"
  config.vm.box_url = "init"

  config.vm.network "forwarded_port", guest: 9200, host: 9200
  config.vm.network "forwarded_port", guest: 5601, host: 5601

  config.vm.provider "virtualbox" do |vb|
      vb.memory = "1024"
  end

  config.vm.provision :puppet do |puppet|
      puppet.manifests_path = "puppet/manifests"
      puppet.module_path = "puppet/modules"
  end

end

Vagrant running directory structure:

vagrant_devenv (master)*$ tree -L 2
.
├── README.rst
├── Vagrantfile
├── installpuppet.sh
├── puppet
│   ├── manifests
│   └── modules
├── requirements.txt
└── ubuntu-xenial-16.04-cloudimg-console.log

Optional:

Just for reference, if needed. I use my old git repo and make local changes for each project. Its not updated for xenial64 but the puppet packages are same. But you can find the puppet manifests and modules I generally use there

Upvotes: 2

Views: 1801

Answers (2)

Fernando Nogueira
Fernando Nogueira

Reputation: 1606

Or you can try this befores config.vm.provision:

web_config.vm.provision "shell", inline: "sudo apt-get update && sudo apt-get install -y puppet"

Just install puppet before run.

Full sample:

Vagrant.configure("2") do |config|
      config.vm.box = "hashicorp/precise32"
      config.vm.define :web do |web_config|

      web_config.vm.provision "shell", inline: "sudo apt-get update && sudo apt-get install -y puppet"
      web_config.vm.provision "puppet" do |puppet|
            puppet.manifests_path = "puppet/manifests"
            puppet.module_path = "puppet/modules"
      end
  end
end

Upvotes: 2

Py_minion
Py_minion

Reputation: 2065

The issue is due to puppet was not found in ubuntu/xenial64. So included a step in installing puppet-agent before puppet provisioning.

I changed the Vagrantfile with an additional step to install puppet-agent before the puppet provision step.

config.vm.provision :"shell", path: "installpuppet.sh"

The updated Vagrantfile

# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure(2) do |config|
  config.vm.box = "ubuntu/xenial64"
  config.vm.hostname = "elasticsearch-learn"
  config.vm.box_url = "init"

  config.vm.network "forwarded_port", guest: 9200, host: 9200
  config.vm.network "forwarded_port", guest: 5601, host: 5601

  config.vm.provider "virtualbox" do |vb|
      vb.memory = "1024"
  end

  config.vm.provision :"shell", path: "installpuppet.sh"
  config.vm.provision :puppet do |puppet|
      puppet.manifests_path = "puppet/manifests"
      puppet.module_path = "puppet/modules"
  end

end

installpuppet.sh contents:

apt update
apt install -y puppet

Then perform the usual 'vagrant up'

This worked for me! Hope it helps. Let me know if there are better solutions.

Upvotes: 2

Related Questions