
Install Chef Workstation
Configure Chef Workstation with Chef Infra Server using Knife
## Configure Workstation using knife to connect with chef server | |
## Creating the Chef repo where all your Chef cookbooks and other files will live is simplified using one of the Chef generators: | |
$ cd ~ | |
$ chef generate repo chef-repo | |
The bold bit can be anything, but chef-repo is descriptive and easy to remember. Running this generator creates a Chef repository and several subdirectories, including ~/chef-repo/cookbooks, where your Chef cookbooks and recipes will live. | |
Initialize Your System - In order to enable your workstation to communicate and interact with your Chef server, you need to create a credentials file. This is located in a directory named .chef in your home directory, such as /home/jsmith/.chef. This folder and credentials file can be created with another generator: | |
$ knife configure init-config | |
## Running this command in a terminal will present you with several questions, including your Chef server URL and the username you created when setting up your server. This will output a ~/.chef/credentials file with contents that look something like this: | |
[default] | |
client_name = 'rajesh' | |
client_key = '~/.chef/rajesh.pem' | |
chef_server_url = 'https://ec2-15-207-198-5.ap-south-1.compute.amazonaws.com/organizations/raj-org' | |
## Edit the credentials file to add your default cookbook location, in this case, the cookbooks folder inside the ~/chef-repo directory you created in the previous step. You can add more than one path, ['/path/to/one', '/path/to/two']: | |
cookbook_path = ['~/chef-repo/cookbooks'] | |
## Copy the rajesh.pem File From Your Chef Server to Your Workstation | |
## The client_key entry in the above .credentials file points to your user.pem file. Copy this file from your Chef server to your workstation and place it in the ~/.chef/ directory using a tool like scp. Alternatively, you can copy the contents of the user.pem file on your Chef server and paste them into a new file on your workstation: | |
$ cd ~/.chef | |
$ scp rajesh@automate.chef.lab:/home/rajesh/rajesh.pem . | |
## Fetch and Verify Your SSL Certs | |
## You’re now ready to fetch the certs, which Chef Workstation will automatically place in the ~/.chef/trusted_certs folder. Certs stored here will be used for secure communication and will be trusted – even if they’re self-signed. | |
$ knife ssl fetch | |
$ knife ssl check | |
## With your certificates successfully verified, test the connection between your workstation and your Chef server with another simple knife command. This will return the name of the client organization you created when setting up your Chef server: | |
$ knife client list | |
lab-validator |






I’m a DevOps/SRE/DevSecOps/Cloud Expert passionate about sharing knowledge and experiences. I am working at Cotocus. I blog tech insights at DevOps School, travel stories at Holiday Landmark, stock market tips at Stocks Mantra, health and fitness guidance at My Medic Plus, product reviews at I reviewed , and SEO strategies at Wizbrand.
Please find my social handles as below;
Rajesh Kumar Personal Website
Rajesh Kumar at YOUTUBE
Rajesh Kumar at INSTAGRAM
Rajesh Kumar at X
Rajesh Kumar at FACEBOOK
Rajesh Kumar at LINKEDIN
Rajesh Kumar at PINTEREST
Rajesh Kumar at QUORA
Rajesh Kumar at WIZBRAND