🚀 DevOps & SRE Certification Program 📅 Starting: 1st of Every Month 🤝 +91 8409492687 🔍 Contact@DevOpsSchool.com

Upgrade & Secure Your Future with DevOps, SRE, DevSecOps, MLOps!

We spend hours on Instagram and YouTube and waste money on coffee and fast food, but won’t spend 30 minutes a day learning skills to boost our careers.
Master in DevOps, SRE, DevSecOps & MLOps!

Learn from Guru Rajesh Kumar and double your salary in just one year.


Get Started Now!

Chef Tutorials: Configure Workstation with knife

configure-the-knife-command

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

Subscribe
Notify of
guest


0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments

Certification Courses

DevOpsSchool has introduced a series of professional certification courses designed to enhance your skills and expertise in cutting-edge technologies and methodologies. Whether you are aiming to excel in development, security, or operations, these certifications provide a comprehensive learning experience. Explore the following programs:

DevOps Certification, SRE Certification, and DevSecOps Certification by DevOpsSchool

Explore our DevOps Certification, SRE Certification, and DevSecOps Certification programs at DevOpsSchool. Gain the expertise needed to excel in your career with hands-on training and globally recognized certifications.

0
Would love your thoughts, please comment.x
()
x