# Chef-zero with vagrant and 127.0.0.1:8889/clients

**URL:** <https://discourse.chef.io/t/chef-zero-with-vagrant-and-127-0-0-1-8889-clients/4511>\
**Category:** Chef Infra (archive)\
**Created:** [September 4, 2013, 4:25pm UTC](https://discourse.chef.io/t/chef-zero-with-vagrant-and-127-0-0-1-8889-clients/4511 "2013-09-04T16:25:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kyle\_Sloan](https://avatars.discourse-cdn.com/v4/letter/k/ce73a5/32.png) [@Kyle\_Sloan](https://discourse.chef.io/u/Kyle_Sloan)\
**Post date:** [September 4, 2013, 4:25pm UTC](https://discourse.chef.io/t/chef-zero-with-vagrant-and-127-0-0-1-8889-clients/4511/1 "2013-09-04T16:25:01Z")

</div>

I am working with chef-zero and all is well when I run the playground commands from [GitHub - chef/chef-zero: Simple, easy-run, fast-start in-memory Chef server for testing and solo purposes](https://github.com/jkeiser/chef-zero)

However when I try a simple vagrant run, vagrant throws

[2013-09-04T16:14:46+00:00] ERROR: Connection refused connecting to 127.0.0.1:8889 for /clients, retry 1/5  
[2013-09-04T16:14:51+00:00] ERROR: Connection refused connecting to 127.0.0.1:8889 for /clients, retry 2/5  
[2013-09-04T16:14:56+00:00] ERROR: Connection refused connecting to 127.0.0.1:8889 for /clients, retry 3/5  
[2013-09-04T16:15:01+00:00] ERROR: Connection refused connecting to 127.0.0.1:8889 for /clients, retry 4/5  
[2013-09-04T16:15:06+00:00] ERROR: Connection refused connecting to 127.0.0.1:8889 for /clients, retry 5/5

I have fiddled to the best of skills with the vagrant chef options from [Vagrant | HashiCorp Developer](http://docs.vagrantup.com/v2/provisioning/chef_client.html)

Here is the snipped from my Vagrant file:

# If you have your own Chef Server, use the appropriate URL, which may be

# HTTP instead of HTTPS depending on your configuration. Also change the

# validation key to validation.pem.

# 

config.vm.provision :chef\_client do |chef|  
chef.chef\_server\_url = "[http://127.0.0.1:8889](http://127.0.0.1:8889)"  
chef.validation\_key\_path = "path\_to\_any\_pem\_file.pem"

```
 # these are "other configuration options" http://docs.vagrantup.com/v2/provisioning/chef_client.html
 # none of them seem to really do anything?
 chef.client_key_path = "mahpath"
 chef.node_name = "plswork"
 chef.validation_client_name = "whyunowork"

```

end

How do I get the vagrant/chef-client to stop trying to use /clients ?

vagrant --version  
Vagrant version 1.2.7

chef-client --version  
Chef: 11.4.0

chef-zero

> > Starting Chef Zero (v1.5.5)...

---

<div class="post-metadata">

**Author:** ![John\_Keiser3](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/john_keiser3/32/428_2.png) [@John\_Keiser3](https://discourse.chef.io/u/John_Keiser3)\
**Post date:** [September 4, 2013, 4:30pm UTC](https://discourse.chef.io/t/chef-zero-with-vagrant-and-127-0-0-1-8889-clients/4511/2 "2013-09-04T16:30:52Z")

</div>

Are you running chef-zero from your workstation or from the vm? The problem is it can't access chef-zero (the /clients endpoint is perfectly valid). I suspect you either need to run chef-zero from within the VM, or that you need to point the vm's chef\_server\_url at the IP of your workstation.

--John

* * *

From: Kyle Sloan [ksloan@2dialog.com](mailto:ksloan@2dialog.com)  
Sent: Wednesday, September 04, 2013 9:25 AM  
To: [chef@lists.opscode.com](mailto:chef@lists.opscode.com)  
Subject: [chef] chef-zero with vagrant and 127.0.0.1:8889/clients

I am working with chef-zero and all is well when I run the playground commands from [GitHub - chef/chef-zero: Simple, easy-run, fast-start in-memory Chef server for testing and solo purposes](https://github.com/jkeiser/chef-zero)

However when I try a simple vagrant run, vagrant throws

[2013-09-04T16:14:46+00:00] ERROR: Connection refused connecting to 127.0.0.1:8889 for /clients, retry 1/5  
[2013-09-04T16:14:51+00:00] ERROR: Connection refused connecting to 127.0.0.1:8889 for /clients, retry 2/5  
[2013-09-04T16:14:56+00:00] ERROR: Connection refused connecting to 127.0.0.1:8889 for /clients, retry 3/5  
[2013-09-04T16:15:01+00:00] ERROR: Connection refused connecting to 127.0.0.1:8889 for /clients, retry 4/5  
[2013-09-04T16:15:06+00:00] ERROR: Connection refused connecting to 127.0.0.1:8889 for /clients, retry 5/5

I have fiddled to the best of skills with the vagrant chef options from [Vagrant | HashiCorp Developer](http://docs.vagrantup.com/v2/provisioning/chef_client.html)

Here is the snipped from my Vagrant file:

# If you have your own Chef Server, use the appropriate URL, which may be

# HTTP instead of HTTPS depending on your configuration. Also change the

# validation key to validation.pem.

# 

config.vm.provision :chef\_client do |chef|  
chef.chef\_server\_url = "[http://127.0.0.1:8889](http://127.0.0.1:8889)"  
chef.validation\_key\_path = "path\_to\_any\_pem\_file.pem"

```
 # these are "other configuration options" http://docs.vagrantup.com/v2/provisioning/chef_client.html
 # none of them seem to really do anything?
 chef.client_key_path = "mahpath"
 chef.node_name = "plswork"
 chef.validation_client_name = "whyunowork"

```

end

How do I get the vagrant/chef-client to stop trying to use /clients ?

vagrant --version  
Vagrant version 1.2.7

chef-client --version  
Chef: 11.4.0

chef-zero

> > Starting Chef Zero (v1.5.5)...

---

<div class="post-metadata">

**Author:** ![Kyle\_Sloan](https://avatars.discourse-cdn.com/v4/letter/k/ce73a5/32.png) [@Kyle\_Sloan](https://discourse.chef.io/u/Kyle_Sloan)\
**Post date:** [September 4, 2013, 5:59pm UTC](https://discourse.chef.io/t/chef-zero-with-vagrant-and-127-0-0-1-8889-clients/4511/3 "2013-09-04T17:59:15Z")

</div>

Thanks… that makes perfect sense and I feel really dumb now heh.

On Sep 4, 2013, at 11:30 AM, John Keiser [jkeiser@opscode.com](mailto:jkeiser@opscode.com) wrote:

> Are you running chef-zero from your workstation or from the vm? The problem is it can't access chef-zero (the /clients endpoint is perfectly valid). I suspect you either need to run chef-zero from within the VM, or that you need to point the vm's chef\_server\_url at the IP of your workstation.
> 
> --John
> 
> * * *
> 
> From: Kyle Sloan [ksloan@2dialog.com](mailto:ksloan@2dialog.com)  
> Sent: Wednesday, September 04, 2013 9:25 AM  
> To: [chef@lists.opscode.com](mailto:chef@lists.opscode.com)  
> Subject: [chef] chef-zero with vagrant and 127.0.0.1:8889/clients
> 
> I am working with chef-zero and all is well when I run the playground commands from [GitHub - chef/chef-zero: Simple, easy-run, fast-start in-memory Chef server for testing and solo purposes](https://github.com/jkeiser/chef-zero)
> 
> However when I try a simple vagrant run, vagrant throws
> 
> [2013-09-04T16:14:46+00:00] ERROR: Connection refused connecting to 127.0.0.1:8889 for /clients, retry 1/5  
> [2013-09-04T16:14:51+00:00] ERROR: Connection refused connecting to 127.0.0.1:8889 for /clients, retry 2/5  
> [2013-09-04T16:14:56+00:00] ERROR: Connection refused connecting to 127.0.0.1:8889 for /clients, retry 3/5  
> [2013-09-04T16:15:01+00:00] ERROR: Connection refused connecting to 127.0.0.1:8889 for /clients, retry 4/5  
> [2013-09-04T16:15:06+00:00] ERROR: Connection refused connecting to 127.0.0.1:8889 for /clients, retry 5/5
> 
> I have fiddled to the best of skills with the vagrant chef options from [Chef Client - Provisioning | Vagrant | HashiCorp Developer](http://docs.vagrantup.com/v2/provisioning/chef_client.html)
> 
> Here is the snipped from my Vagrant file:
> 
> # If you have your own Chef Server, use the appropriate URL, which may be
> 
> # HTTP instead of HTTPS depending on your configuration. Also change the
> 
> # validation key to validation.pem.
> 
> # 
> 
> config.vm.provision :chef\_client do |chef|  
> chef.chef\_server\_url = "[http://127.0.0.1:8889](http://127.0.0.1:8889)"  
> chef.validation\_key\_path = "path\_to\_any\_pem\_file.pem"
> 
> ```
> # these are "other configuration options" http://docs.vagrantup.com/v2/provisioning/chef_client.html
> # none of them seem to really do anything?
> chef.client_key_path = "mahpath"
> chef.node_name = "plswork"
> chef.validation_client_name = "whyunowork"
> 
> ```
> 
> end
> 
> How do I get the vagrant/chef-client to stop trying to use /clients ?
> 
> vagrant --version  
> Vagrant version 1.2.7
> 
> chef-client --version  
> Chef: 11.4.0
> 
> chef-zero
> 
> > > Starting Chef Zero (v1.5.5)...

---

<div class="post-metadata">

**Author:** ![Carlton\_Stedman](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/carlton_stedman/32/472_2.png) [@Carlton\_Stedman](https://discourse.chef.io/u/Carlton_Stedman)\
**Post date:** [September 4, 2013, 6:30pm UTC](https://discourse.chef.io/t/chef-zero-with-vagrant-and-127-0-0-1-8889-clients/4511/4 "2013-09-04T18:30:18Z")

</div>

If you use the vagrant-chef-zero plugin for vagrant and do not start up  
chef-zero separately, it all seems to work -- "vagrant up" starts chef  
zero, berkshelf can upload cookbooks to it, the plugin will upload all JSON  
roles/environments/databags in the path, et cetera.

Can do something like this in Vagrantfile:

```
case provisioner
when 'chef', 'chef_zero'
  config.vm.provision :chef_client do |chef|
    if provisioner == 'chef'
      chef.chef_server_url = "https://#{chef_server}/organizations/#{org}"
      chef.validation_key_path =
        "#{chef_dir}/validation/#{org}-validator.pem"
      chef.validation_client_name = "#{org}-validator"
      chef.client_key_path = "/etc/chef/client.pem"
    else
      config.chef_zero.enabled = true
      config.chef_zero.chef_repo_path = dataroot
    end
    chef.provisioning_path = "/etc/chef"
    chef.log_level = :debug
    chef.run_list = run_list
  end

```

Regards,  
Carlton

On Wed, Sep 4, 2013 at 1:59 PM, Kyle Sloan [ksloan@2dialog.com](mailto:ksloan@2dialog.com) wrote:

> Thanks… that makes perfect sense and I feel really dumb now heh.
> 
> On Sep 4, 2013, at 11:30 AM, John Keiser [jkeiser@opscode.com](mailto:jkeiser@opscode.com) wrote:
> 
> > Are you running chef-zero from your workstation or from the vm? The  
> > problem is it can't access chef-zero (the /clients endpoint is perfectly  
> > valid). I suspect you either need to run chef-zero from within the VM, or  
> > that you need to point the vm's chef\_server\_url at the IP of your  
> > workstation.
> > 
> > --John
> > 
> > * * *
> > 
> > From: Kyle Sloan [ksloan@2dialog.com](mailto:ksloan@2dialog.com)  
> > Sent: Wednesday, September 04, 2013 9:25 AM  
> > To: [chef@lists.opscode.com](mailto:chef@lists.opscode.com)  
> > Subject: [chef] chef-zero with vagrant and 127.0.0.1:8889/clients
> > 
> > I am working with chef-zero and all is well when I run the playground  
> > commands from [GitHub - chef/chef-zero: Simple, easy-run, fast-start in-memory Chef server for testing and solo purposes](https://github.com/jkeiser/chef-zero)
> > 
> > However when I try a simple vagrant run, vagrant throws
> > 
> > [2013-09-04T16:14:46+00:00] ERROR: Connection refused connecting to  
> > 127.0.0.1:8889 for /clients, retry 1/5  
> > [2013-09-04T16:14:51+00:00] ERROR: Connection refused connecting to  
> > 127.0.0.1:8889 for /clients, retry 2/5  
> > [2013-09-04T16:14:56+00:00] ERROR: Connection refused connecting to  
> > 127.0.0.1:8889 for /clients, retry 3/5  
> > [2013-09-04T16:15:01+00:00] ERROR: Connection refused connecting to  
> > 127.0.0.1:8889 for /clients, retry 4/5  
> > [2013-09-04T16:15:06+00:00] ERROR: Connection refused connecting to  
> > 127.0.0.1:8889 for /clients, retry 5/5
> > 
> > I have fiddled to the best of skills with the vagrant chef options from  
> > [Chef Client - Provisioning | Vagrant | HashiCorp Developer](http://docs.vagrantup.com/v2/provisioning/chef_client.html)
> > 
> > Here is the snipped from my Vagrant file:
> > 
> > # If you have your own Chef Server, use the appropriate URL, which may
> 
> be
> 
> > # HTTP instead of HTTPS depending on your configuration. Also change the
> > 
> > # validation key to validation.pem.
> > 
> > # 
> > 
> > config.vm.provision :chef\_client do |chef|  
> > chef.chef\_server\_url = "[http://127.0.0.1:8889](http://127.0.0.1:8889)"  
> > chef.validation\_key\_path = "path\_to\_any\_pem\_file.pem"
> > 
> > ```
> > # these are "other configuration options"
> > 
> > ```
> 
> [Chef Client - Provisioning | Vagrant | HashiCorp Developer](http://docs.vagrantup.com/v2/provisioning/chef_client.html)
> 
> > ```
> > # none of them seem to really do anything?
> > chef.client_key_path = "mahpath"
> > chef.node_name = "plswork"
> > chef.validation_client_name = "whyunowork"
> > 
> > ```
> > 
> > end
> > 
> > How do I get the vagrant/chef-client to stop trying to use /clients ?
> > 
> > vagrant --version  
> > Vagrant version 1.2.7
> > 
> > chef-client --version  
> > Chef: 11.4.0
> > 
> > chef-zero
> > 
> > > > Starting Chef Zero (v1.5.5)...
