Blog

Thoughts from my daily grind

Vagrant Chef - Vagrant could not detect Chef

Posted by Ziyan Junaideen |Published: 24 May 2021 |Category: Linux Systems Admin
Default Upload |

I am an experienced Linux Systems Administrator, and yet I find server configuration tedious. The heroes that come to save me from endless sudo are Chef and Chef-Solo. There is no reason to configure a server manually, risking a misconfiguration, when you can use a tool like Chef to automate the process.

I was working on this website, and it was time to upgrade to Ruby on Rails 6. I destroyed the Vagrant VirtualBox virtual machine and rebuilt it. Then I encountered this error.

==> default: Running provisioner: chef_solo...
    default: Installing Chef (latest)...
    Vagrant could not detect Chef on the guest!...

I did a vagrant ssh and checked for chef-solo. To my surprise, Vagrant had already installed it. Since it is already installed, I skipped the install. This is done by adding chef.install = false to the chef configuration block.

  config.vm.provision "chef_solo" do |chef|
    chef.install = false
    chef.custom_config_path = "#{cookbook_path}/config.chef"
    chef.cookbooks_path = ["#{cookbook_path}/berks-cookbooks"]
    chef.nodes_path = "#{cookbook_path}/nodes"
    # ...

Then when I ran vagrant up, the installation proceeded as usual. I am not sure what exactly happened, but I hope it gets fixed in the future. Make sure to remove the chef.install = false after you are done, or you will forget that it is there.

Tags
About the Author

Ziyan Junaideen -

Ziyan is an expert Ruby on Rails web developer with 8 years of experience specializing in SaaS applications. He spends his free time he writes blogs, drawing on his iPad, shoots photos.

Comments