Chef:
Chef is a powerful tool for automation that transforms infrastructure into code. Whether you're operating in the cloud or on-premises or in Hybrid Environment. Chef automates how infrastructure is configured, deployed and managed across your network.
Three main part of Chef.

Prerequisites:
Follow these commands to finish the installation on Ubuntu 16.04:
To download:
To Install:
It will take a few minutes to finish the installation:
Step 2- Setup Hosted Chef Server:
Open the browser and hit this URL to sign up https://manage.chef.io/signup
Fill out your details as in picture below

Once sign up process complete, log in to your account and follow the steps below to complete initial set up.


In the above screenshot highlighted is my Deployment kit name.
Please remember to create and upload cookbook to chef server inside this directory Because it has Chef Server organization information and private key to communicate chef server. You can check Chef server details in .chef file.
Now, We are ready to start writing recipes and start upload cookbook to Chef server.
Step 3- Start Writing Chef recipes and cookbook.
Step 4- Perform Jenkins installation on the remote machine using a cookbook.


Chef is a powerful tool for automation that transforms infrastructure into code. Whether you're operating in the cloud or on-premises or in Hybrid Environment. Chef automates how infrastructure is configured, deployed and managed across your network.
Three main part of Chef.
- Chef Workstation (SDK) - Where we write recipe and Cookbook
- Chef Server - Hold Cookbook, roles, Node information and manage Nodes
- Chef Client Node - Manage by Chef Server, each deployment and configuration done by Chef Server

Prerequisites:
- One Linux or Windows Machine (For chef Workstation)
- Chef Server account
- One Linux System to perform the installation using cookbook
Step 1- Setup Chef Workstation:
We can use either Windows or Linux system to set up as Chef Workstation. Download and install Chef workstation SDK from its official website. Download Chef SDK https://downloads.chef.io/chefdk/ and install on your favourite system.
Follow these commands to finish the installation on Ubuntu 16.04:
To download:
To Install:
It will take a few minutes to finish the installation:
Step 2- Setup Hosted Chef Server:
Open the browser and hit this URL to sign up https://manage.chef.io/signup
Fill out your details as in picture below

Once sign up process complete, log in to your account and follow the steps below to complete initial set up.
- Click on administration tab and choose to Create button under the organization

- Download Starter Kit- it provides an interface between chef workstation and chef Server to communicate and upload cookbook to chef server.

- Once Download finished, Go to the downloaded directory.

- Extract Starter Kit on your Workstation.
- Go to Chef-repo directory
- Verify extracted files with .chef configuration file.
Please remember to create and upload cookbook to chef server inside this directory Because it has Chef Server organization information and private key to communicate chef server. You can check Chef server details in .chef file.
Now, We are ready to start writing recipes and start upload cookbook to Chef server.
Step 3- Start Writing Chef recipes and cookbook.
- Generate template for your own custom cookbook, though N number of cookbooks are available on the Internet. In this Example, I'm going to demonstrate Jenkins installation using Chef cookbook.
- Open configuration file:
- Append following configuration
- Jenkins installation Cookbook is ready. Let's upload to our hosted Chef Server.
Step 4- Perform Jenkins installation on the remote machine using a cookbook.
- Make sure you can SSH to the Node from Workstation. Run the following command to perform an installation with User Name and Password.
- If you have access using Key file run the following command.
Upon successful installation, you will get output like this.

Jenkins installation completed successfully, let's verify the installation by accessing Node01 IP address with Jenkins port - 8080
http://10.0.1.170:8080/
Jenkins installation is done successfully. Now you can create your own custom Chef cookbook for various configuration and installation.
Optional: Now, You can manage your node from your hosted Chef account, You can list your added node in the Chef console. Please see below picture for more detail.

Optional: Now, You can manage your node from your hosted Chef account, You can list your added node in the Chef console. Please see below picture for more detail.
