Using ip address for chef_server_url on /etc/chef/client.rb


#1

Hi, Using a hostname in etc/chef/client.rb for chef_server_url is not an
option for me, Hence I’m forced to use a ip address for my chef server.
Firstly , is this even allowed.?

Second, at some point the chef-client tries to reverse lookup the ip
address and tries to find the hostname(The DNS will return NXDOMAIN) and
is not working.

Can someone help me out.?

Santhosh


#2

Santhosh,

I just encounters this very thing.
Here is what I have done and it works:

In the client.rb file, I reference the chef server with the value "https://

I am using ‘knife vsphere vm clone’ to create my VMs.

In the VM template that I am cloning, I have added the Chef Server hostname and IPaddr to the /etc/hosts file.

When the clone is created and the bootstrap (passed as option to knife vsphere) initiated, it is

  • successfully resolving and connecting to the chef server,
  • creating the node,
  • kicking off the cookbook (passed using the runlist option to knife vsphere)

Hope that helps

Anna

Sent from my iPhone

On Feb 28, 2014, at 1:30 PM, Santhosh santhoshsusbs@gmail.com wrote:

Hi, Using a hostname in etc/chef/client.rb for chef_server_url is not an option for me, Hence I’m forced to use a ip address for my chef server. Firstly , is this even allowed.?

Second, at some point the chef-client tries to reverse lookup the ip address and tries to find the hostname(The DNS will return NXDOMAIN) and is not working.

Can someone help me out.?

Santhosh


#3

Anna, I’m glad it worked for you, but no luck here. Had to look at the
chef code for a couple of hours and I’ve found the fix , finally

*misconceptions:

  • *there is no reverse dns lookup’s that chef-client is doing.

*workflow:
** when we run chef-server reconfigure for the first time , it
configures(server_name) and identifies as what is given by the hostname
(if given)

  • So, I just told the chef-server (using /etc/chef-server/chef-server.rb
    to use server_name as my public ip) and ran reconfigure again.
  • Magic!

*Few more questions:
** what are the ramifications of running a chef-server reconfigure after
we have setup a bunch of nodes. Do i have to edit/modify any of my nodes.?

Regards
Santhosh
On 3/1/2014 1:23 AM, Anna Redding wrote:

Santhosh,

I just encounters this very thing.
Here is what I have done and it works:

In the client.rb file, I reference the chef server with the value "https://

I am using ‘knife vsphere vm clone’ to create my VMs.

In the VM template that I am cloning, I have added the Chef Server hostname and IPaddr to the /etc/hosts file.

When the clone is created and the bootstrap (passed as option to knife vsphere) initiated, it is
- successfully resolving and connecting to the chef server,
- creating the node,
- kicking off the cookbook (passed using the runlist option to knife vsphere)

Hope that helps

Anna

Sent from my iPhone

On Feb 28, 2014, at 1:30 PM, Santhosh santhoshsusbs@gmail.com wrote:

Hi, Using a hostname in etc/chef/client.rb for chef_server_url is not an option for me, Hence I’m forced to use a ip address for my chef server. Firstly , is this even allowed.?

Second, at some point the chef-client tries to reverse lookup the ip address and tries to find the hostname(The DNS will return NXDOMAIN) and is not working.

Can someone help me out.?

Santhosh