Chef

Table Of Contents

Install Chef Server 11.x

The Chef server acts as a hub for configuration data. The Chef server stores cookbooks, the policies that are applied to nodes, and metadata that describes each registered node that is being managed by the chef-client. Nodes use the chef-client to ask the Chef server for configuration details, such as recipes, templates, and file distributions. The chef-client then does as much of the configuration work as possible on the nodes themselves (and not on the Chef server). This scalable approach distributes the configuration effort throughout the organization.

The steps below describe the process for installing Chef Server 11.x.

Steps

To install Chef Server 11.x, do the following:

  1. Go to http://www.getchef.com/chef/install/.

  2. Click the Chef Server tab.

  3. Select the operating system, version, and architecture.

  4. Select the version of Chef Server 11.x to download, and then click the link that appears to download the package.

  5. Install the downloaded package using the correct method for the operating system on which Chef Server 11.x will be installed.

  6. Configure Chef Server 11.x by running the following command:

    $ sudo chef-server-ctl reconfigure
    

    This command will set up all of the required components, including Erchef, RabbitMQ, and PostgreSQL.

  7. Verify the the hostname for the Chef server by running the hostname command. The hostname for the Chef server must be a FQDN.

  8. Verify the installation of Chef Server 11.x by running the following command:

    $ sudo chef-server-ctl test
    

    This will run the chef-pedant test suite against the installed Chef Server 11.x and will report back that everything is working and installed correctly.

  9. Set up a workstation.

  10. From the workstation, verify the install by running the following commands to ensure that every chef-client and user was registered correctly.

    $ knife client list
    

    and:

    $ knife user list
    

About FQDNs and Hostnames

The hostname for the Chef server must meet the following requirements:

  1. The hostname must be a FQDN, including the domain suffix. For example, something like mychefserver.example.com (and not something like mychefserver)
  2. The hostname must be resolvable. In most cases, such as for a Chef server that will run in a production environment, add the hostname for the Chef server to the DNS system. In some cases, such as when deploying Chef server into a testing environment, just adding the hostname to the /etc/hosts file is enough to ensure that a hostname is resolvable

The api_fqdn setting can be added to the private-chef.rb file (it is not there by default). When added, its value should be equal to the FQDN for the service URI used by the Chef server. Then configure the same value for the bookshelf['vip'] setting prior to installing Enterprise Chef. For example: api_fqdn "chef.example.com".

To verify if a hostname is a FQDN

To verify if a hostname is a FQDN, run the following command:

$ hostname

If the hostname is a FQDN, it will return something like:

$ mychefserver.example.com

If the hostname is not a FQDN, it must be configured so that it is one.

To verify is a hostname is resolvable

To verify is a hostname is resolvable, run the following command:

$ hostname -f

If the hostname is resolvable, it will return something like:

$ mychefserver.example.com

To change a hostname

In some cases, the hostname for the Chef server needs to be updated. The process for updating a hostname varies, depending on the platform on which the Chef server will run. Refer to the manual for the platform or contact a local systems administrator for specific guidance for a specific platform. The following example shows how a hostname can be changed when running Red Hat or CentOS:

$ sudo hostname 'mychefserver.example.com'

and then:

$ echo "mychefserver.example.com" | sudo tee /etc/hostname

To add a hostname to /etc/hosts

If a hostname is not resolvable, refer to a local systems administrator for specific guidance on how to add the hostname to the DNS system. If the Chef server is being into a testing environment, just add the hostname to /etc/hosts. The following example shows how a hostname can be added to /etc/hosts when running Red Hat or CentOS:

$ echo -e "127.0.0.2 `hostname` `hostname -s`" | sudo tee -a /etc/hosts