Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I've been using opscode chef for remote configuration and I wanted to test my chef scripts locally, so I started working on setting up a vagrant box. But, I can't seem to get my vagrant boxes to register. I get errors like the ones listed here: https://gist.github.com/2961246

My Vagrantfile looks like this:

Vagrant::Config.run do |config|
  config.vm.box = "lucid32"

  config.vm.forward_port 80, 8080

  config.vm.provision :chef_client do |chef|
   chef.chef_server_url = "https://api.opscode.com/organizations/pinedesk"
   chef.validation_key_path = ".chef/pinedesk-validator.pem"
   chef.validation_client_name = "pinedesk-validator"
   chef.node_name = "vagrant"
   chef.provisioning_path = "/etc/chef"
   chef.log_level = :debug

   chef.add_role "base"
  end
end

And my .chef folder has these:

dsummersl.pem
knife.rb
pinedesk-validator.pem
vagrant.pem

Chef appears appears to register a new client, and then gets an HTTP 401 when creating the node. Any pointers?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

It appears you are trying to register a new client by a name that already exists.

If you run knife client list you should see a client name that matches your vagrant vm's host name

Assuming the hostname is 'vagrant' you could run this:

for foo in client node ; do knife $foo delete vagrant -y ; done

then run vagrant up or vagrant provision

You will probably want to delete the client and node after every vagrant destroy

share|improve this answer
    
Cassiano Leal's vagrant-butcher gem ensures that nodes and clients associated with your Vagrant VMs are deleted when the VMs are destroyed. –  cwjohnston Dec 31 '12 at 8:48
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.