How To Configure Chef on Ubuntu 17.04

How To Configure Chef on Ubuntu 17.04.

Chef is a free and open source configuration management tool written in Ruby and Erlang. Chef can easily integrate with cloud-based platforms such as AWS, OpenStack, or RackSpace, etc to automatically create and manage the servers. When an organization grows and the number of nodes increases, it becomes difficult for a system administrator to manage each node by himself,in this scenario chef comes to rescue. In our previous tutorial, we have covered the method to install Chef on Ubuntu 17.04, and here we are going to help you get an idea about the method to configure Chef on Ubuntu 17.04.

Configuring Chef

First run the following command to start all the services required for Chef to work.

root@linuxhelp:~# chef-server-ctl reconfigure


The above command will take few minutes to complete as it installs and configures all the components of the chef server. Once successfully finished, you should get the following message at the end.

Chef Client finished, 492/1080 resources updated in 04 minutes 43 seconds
Chef Server Reconfigured!

And then, make sure that the services are started successfully by running the following command.

root@linuxhelp:~# chef-server-ctl status
run: bookshelf: (pid 9500) 154s  run: log: (pid 9523) 153s
run: nginx: (pid 9343) 162s  run: log: (pid 9850) 146s
run: oc_bifrost: (pid 9252) 166s  run: log: (pid 9259) 165s
run: oc_id: (pid 9333) 163s  run: log: (pid 9338) 163s
run: opscode-erchef: (pid 9698) 152s  run: log: (pid 9645) 153s
run: opscode-expander: (pid 9397) 156s  run: log: (pid 9493) 156s
run: opscode-solr4: (pid 9377) 160s  run: log: (pid 9393) 158s
run: postgresql: (pid 9232) 168s  run: log: (pid 9236) 168s
run: rabbitmq: (pid 8776) 184s  run: log: (pid 8653) 191s
run: redis_lb: (pid 8590) 256s  run: log: (pid 9845) 148s


Now, you shall install the web management console - Chef manage. Chef provides a web-based graphical user interface to administrator Chef server.

root@linuxhelp:~# chef-server-ctl install chef-manage
Starting Chef Client, version 12.19.36
resolving cookbooks for run list: [" private-chef::add_ons_wrapper" ]
.
.
Running handlers complete
Chef Client finished, 4/5 resources updated in 05 minutes 56 seconds

After that, you need to reconfigure Chef server again by making use of the following command.

root@linuxhelp:~# chef-server-ctl reconfigure
.
.
Chef Client finished, 46/573 resources updated in 01 minutes 14 seconds
Chef Server Reconfigured!

Finally, configure Chef Manage by running the following command.

root@linuxhelp:~# chef-manage-ctl reconfigure
Chef Client finished, 90/266 resources updated in 01 minutes 08 seconds
chef-manage Reconfigured!

Before you can log in and use the administrative console, you will need to create a user and organization. During user and organization creation, it automatically generates RSA private keys which are required to connect to workstations and client. You can create a new .chef directory to store the keys. Run the command to create a new directory to store private keys.

root@linuxhelp:~# mkdir ~/.chef

Now create a new administrator by running the following command.

root@linuxhelp:~# chef-server-ctl user-create admin Chef Administrator chef@linuxhelp.com Password -f ~/.chef/admin.pem

Then, you need to replace admin with your preferred username, Chef with first name and Administrator with the last name, chef@yourdomain.com with your email and admin.pem should be according to your username. Replace Strong Password with a very strong password. And then create a new organization by running the following command.

root@linuxhelp:~# chef-server-ctl org-create my_org ' My Organization'  --association_user admin -f ~/.chef/my_org.pem


Replace my_org with the short name of your organization, My Organization with the full name of your organization and admin with the administrative user you have created.
Now that everything required to access the web console is installed and configured. Go to your browser and give the following URL
http://Your-Server-IP


You can also use your domain name instead of server IP if you have the domain configured. You should see the following login screen.

FAQ
Q
What is chef what for it is used?
A
Chef is a free and open source configuration management tool.
It is written in Ruby and Erlang. Chef can easily integrate with cloud-based
platforms such as AWS, OpenStack, or RackSpace, etc.
Q
Whether Chef is paid service?
A
No, chef is free and open source software.
Q
How to manage web console for chef ?
A
execute the command as follow to manage web console of chef "chef-server-ctl install chef-manage".
Q
How to create admin account for chef?
A
use the following command to create admin account for chef
# chef-server-ctl user-create admin Chef Administrator chef@linuxhelp.com Password -f ~/.chef/admin.pem
Q
What is chef workstation?
A
A workstation is a computer running the Chef Development Kit (Chef DK) that is used to author cookbooks, interact with the Chef server, and interact with nodes. The workstation is where users do most of their work, including: Developing and testing cookbooks and recipes.