How to get Chef Server to add itself as a node?

How do I get my Chef Server to add itself as a node during provisioning?

how you provision chef server?

On Wed, Jun 10, 2015 at 12:36 PM, Greg Barker fletch@fletchowns.net wrote:

How do I get my Chef Server to add itself as a node during provisioning?

Last time I used the aws cli to spin up an EC2 instance that will become my
chef server.

Then I ran a simple little fabric script that does the following:

  • Copies encrypted_data_bag_secret, bitbucket deploy key, and known_hosts
    file to the instance
  • yum install git
  • Clone down my chef repo from bitbucket
  • Runs berks package on my cookbooks, copies it to the instance, and untar
    it (I think berks package is run locally, maybe it should be run on the
    server?)
  • Creates a solo.rb file
  • Run chef-solo with run list role[mycorp_chef_server], from there it’s
    mainly just the chef-server cookbook

I haven’t looked at this script in awhile, maybe there’s a better way to go
about this?

On Wed, Jun 10, 2015 at 1:39 PM, Ranjib Dey dey.ranjib@gmail.com wrote:

how you provision chef server?

On Wed, Jun 10, 2015 at 12:36 PM, Greg Barker fletch@fletchowns.net
wrote:

How do I get my Chef Server to add itself as a node during provisioning?

You did the initial setup with Chef solo, which makes sense, because Chef
solo doesn’t require a Chef server, right? Solves the chicken & egg problem
when setting up your Chef server.

Now that it’s set up and presumably working as a Chef server, you need to
start using Chef Client to manage it. Not Chef solo :slight_smile:

Mat

On Thu, Jun 11, 2015 at 8:01 AM Greg Barker fletch@fletchowns.net wrote:

Last time I used the aws cli to spin up an EC2 instance that will become
my chef server.

Then I ran a simple little fabric script that does the following:

  • Copies encrypted_data_bag_secret, bitbucket deploy key, and known_hosts
    file to the instance
  • yum install git
  • Clone down my chef repo from bitbucket
  • Runs berks package on my cookbooks, copies it to the instance, and untar
    it (I think berks package is run locally, maybe it should be run on the
    server?)
  • Creates a solo.rb file
  • Run chef-solo with run list role[mycorp_chef_server], from there it’s
    mainly just the chef-server cookbook

I haven’t looked at this script in awhile, maybe there’s a better way to
go about this?

On Wed, Jun 10, 2015 at 1:39 PM, Ranjib Dey dey.ranjib@gmail.com wrote:

how you provision chef server?

On Wed, Jun 10, 2015 at 12:36 PM, Greg Barker fletch@fletchowns.net
wrote:

How do I get my Chef Server to add itself as a node during provisioning?

So is it simply a matter of adding the chef-client cookbook and setting the
node[“chef-client”][“config”][“chef_server_url”] since knife ec2 server create isn’t doing that for me like it does for my other nodes?

On Thu, Jun 11, 2015 at 5:29 AM, Mathieu Martin webmat@gmail.com wrote:

You did the initial setup with Chef solo, which makes sense, because Chef
solo doesn’t require a Chef server, right? Solves the chicken & egg problem
when setting up your Chef server.

Now that it’s set up and presumably working as a Chef server, you need to
start using Chef Client to manage it. Not Chef solo :slight_smile:

Mat

On Thu, Jun 11, 2015 at 8:01 AM Greg Barker fletch@fletchowns.net wrote:

Last time I used the aws cli to spin up an EC2 instance that will become
my chef server.

Then I ran a simple little fabric script that does the following:

  • Copies encrypted_data_bag_secret, bitbucket deploy key, and known_hosts
    file to the instance
  • yum install git
  • Clone down my chef repo from bitbucket
  • Runs berks package on my cookbooks, copies it to the instance, and
    untar it (I think berks package is run locally, maybe it should be run on
    the server?)
  • Creates a solo.rb file
  • Run chef-solo with run list role[mycorp_chef_server], from there it’s
    mainly just the chef-server cookbook

I haven’t looked at this script in awhile, maybe there’s a better way to
go about this?

On Wed, Jun 10, 2015 at 1:39 PM, Ranjib Dey dey.ranjib@gmail.com wrote:

how you provision chef server?

On Wed, Jun 10, 2015 at 12:36 PM, Greg Barker fletch@fletchowns.net
wrote:

How do I get my Chef Server to add itself as a node during provisioning?

You left out “make sure DNS and/or /etc/hosts make a working ‘hostname --fqdn’ setup before running chef-server or chef-client”.

A lot of people leave this out of their setup notes, but it saves a lot of trouble.

Nico Kadel-Garcia
Email: nkadel@gmail.commailto:kadel@gmail.com
Sent from iPhone

On Jun 11, 2015, at 8:01, “Greg Barker” <fletch@fletchowns.netmailto:fletch@fletchowns.net> wrote:

Last time I used the aws cli to spin up an EC2 instance that will become my chef server.

Then I ran a simple little fabric script that does the following:

  • Copies encrypted_data_bag_secret, bitbucket deploy key, and known_hosts file to the instance
  • yum install git
  • Clone down my chef repo from bitbucket
  • Runs berks package on my cookbooks, copies it to the instance, and untar it (I think berks package is run locally, maybe it should be run on the server?)
  • Creates a solo.rb file
  • Run chef-solo with run list role[mycorp_chef_server], from there it’s mainly just the chef-server cookbook

I haven’t looked at this script in awhile, maybe there’s a better way to go about this?

On Wed, Jun 10, 2015 at 1:39 PM, Ranjib Dey <dey.ranjib@gmail.commailto:dey.ranjib@gmail.com> wrote:
how you provision chef server?

On Wed, Jun 10, 2015 at 12:36 PM, Greg Barker <fletch@fletchowns.netmailto:fletch@fletchowns.net> wrote:
How do I get my Chef Server to add itself as a node during provisioning?

On Thursday, June 11, 2015 at 4:43 PM, Nico Kadel-Garcia wrote:

You left out “make sure DNS and/or /etc/hosts make a working ‘hostname --fqdn’ setup before running chef-server or chef-client”.

A lot of people leave this out of their setup notes, but it saves a lot of trouble.

Nico Kadel-Garcia
Email: nkadel@gmail.com (mailto:kadel@gmail.com)
Sent from iPhone

For chef-client, it’s not strictly necessary. We set the node name of all of our EC2 hosts to the instance id and manage the hostname with Chef using an API-friendly DNS provider. But if you are using the hostname detection for your node names, then yes, you’ll have a bad time if the hostname isn’t set.


Daniel DeLeo