A Chef workstation is a system, which we use to develop recipes and cookbooks and interact with a chef nodes. It helps in configuring organizational policy, including defining roles & environments and ensuring that critical data is being stored in data bags. The workstation is the location from which most users will do most of their work, including: Developing cookbooks and recipes (and authoring them using Ruby). Keeping the chef-repo synchronized with version source control. Using Knife to upload items from the chef-repo to the server. Configuring organizational policy, including defining roles and environments and ensuring that critical data is stored in data bags. Interacting with nodes, as (or when) required, such as performing a bootstrap operation.
1. How to Install the Chef Server on CentOS/RHEL 5/6/7
2. What is Chef Automation Tool and It’s Features
3. Puppet vs. Chef vs. Ansible vs. SaltStack
4. How to connect Chef Server with Nodes on Linux
Chef workstation requires when you want to interact with the chef server, or any chef nodes (servers, network equipment, etc). On Chef workstation you create cookbooks or recipes that will be executed on the individual chef nodes.
What is ChefDK?
The Chef Development Kit is a package that contains everything that is needed to start using Chef: chef-client and ohai chef command line tool Testing tools such as Test Kitchen, ChefSpec, Cookstyle, and Foodcritic Chef provisioning Everything else needed to author cookbooks and upload them to the Chef server
Step 1: Prerequisite
First we need to install below packages.
# yum install -y wget curl git
Step 2: Download ChefDK
ChefDK stands for Chef Development Kit. ChefDK is available for all the platform. You can download the ChefDK latest package from official website also.
For CentOS/RHEL 7 64 Bit
# wget https://packages.chef.io/files/stable/chefdk/2.0.28/el/7/chefdk-2.0.28-1.el7.x86_64.rpm
For CentOS/RHEL 6 64 Bit
# wget https://packages.chef.io/files/stable/chefdk/2.0.28/el/6/chefdk-2.0.28-1.el6.x86_64.rpm
Install the RPM package using below command.
For CentOS/RHEL 7 64 Bit
# rpm -ivh chefdk-2.0.28-1.el7.x86_64.rpm
For CentOS/RHEL 6 64 Bit
# rpm -ivh chefdk-2.0.28-1.el6.x86_64.rpm
Step 3: Verify ChefDK Installation
Now we will run below command to verify all different components that comes with ChefDK to make sure they all works properly without any issues as shown below.
# chef verify
[WARN] This is an internal command used by the ChefDK development team. If you are a ChefDK user, please do not run it.
Running verification for component 'berkshelf'
Running verification for component 'test-kitchen'
Running verification for component 'tk-policyfile-provisioner'
Running verification for component 'chef-client'
Running verification for component 'chef-dk'
Running verification for component 'chef-provisioning'
Running verification for component 'chefspec'
Running verification for component 'generated-cookbooks-pass-chefspec'
Running verification for component 'fauxhai'
Running verification for component 'knife-spork'
Running verification for component 'kitchen-vagrant'
Running verification for component 'package installation'
Running verification for component 'openssl'
Running verification for component 'inspec'
Running verification for component 'delivery-cli'
Running verification for component 'git'
Running verification for component 'opscode-pushy-client'
Running verification for component 'chef-sugar'
......................................./opt/chefdk/embedded/lib/ruby/gems/2.4.0/gems/chef-provisioning-aws-2.2.2/lib/chef/resource/aws_route53_record_set.rb:48: warning: constant ::Fixnum is deprecated
Verification of component 'fauxhai' succeeded.
Verification of component 'kitchen-vagrant' succeeded.
Verification of component 'openssl' succeeded.
Verification of component 'delivery-cli' succeeded.
Verification of component 'test-kitchen' succeeded.
Verification of component 'opscode-pushy-client' succeeded.
Verification of component 'berkshelf' succeeded.
Verification of component 'chefspec' succeeded.
Verification of component 'knife-spork' succeeded.
Verification of component 'tk-policyfile-provisioner' succeeded.
Verification of component 'chef-dk' succeeded.
Verification of component 'inspec' succeeded.
Verification of component 'chef-sugar' succeeded.
Verification of component 'chef-client' succeeded.
Verification of component 'package installation' succeeded.
Verification of component 'chef-provisioning' succeeded.
Verification of component 'generated-cookbooks-pass-chefspec' succeeded.
Verification of component 'git' succeeded.
Note: Some times we get error message “Could not find ‘chef-config’ (= 12.8.0) – did find: [chef-config-12.7.2] (Gem::LoadError)””.
This error is coming because your setup is not matching with a ChefDK version so upgrade the ChefDK package to resolve the issue.
Step 4: Check Chef Version
When installation finished use below command to verify the version.
# chef-client -v
Use below command to show the version number of ChefDK and all the components that comes with it as shown below.
# chef --version
Chef Development Kit Version: 2.0.28
chef-client version: 13.2.20
delivery version: master (17c1b0fed9be4c70f69091a6d21a4cbf0df60a23)
berks version: 6.2.0
kitchen version: 1.16.0
inspec version: 1.31.1