Table of Contents
In this session, we will look into 35 Important Chef Interview Questions and Answers for DevOps Professionals. Chef is a vey important Infrastructure provisioning tool used for Automation Purposes. Check more about Chef on Official Documentation. DevOps Professionals very often uses this tool hence it is very important for a candidate to have complete Knowledge about the tool before going for Chef Interviews. Here we will look into all the frequently asked Chef Interview Questions.
Chef Interview Questions and Answers for DevOps Professionals
Also Read: 25 Best AWS CI/CD Interview Questions and Answers for Cloud Developers
1. What are different Chef workstation tools ?
Ans. Few of the Tools are:-
a)chef-apply
b)chef-run
c)chef-shell
d)chef-vault
2. Which command can be used to generate an attribute file in the /attributes directory ?
Ans. chef generate attribute COOKBOOK_PATH NAME
3. What is the command to generate a cookbook ?
Ans. chef generate cookbook
4. What is the command to configure the environment for Chef Workstation ?
Ans. chef env
5. What is the command to generate a file in the /files directory ?
Ans. chef generate file
6. What is the command to run any shell commands ?
Ans. chef exec SYSTEM_COMMAND
7. Which command is used by Chef to install RubyGems into Chef Workstation ?
Ans. chef gem GEM_COMMAND GEM_OPTIONS
8. What is the command to List all local gems ?
Ans. chef gem list
9. How to List all of the gems with knife in their title ?
Ans. chef gem list knife
10. Which command is used to search for remote gems available for Installation ?
Ans. chef gem search kitchen
11. Which command can be used to uninstall knife-config gem from Chef Workstation ?
Ans. chef gem uninstall knife-config
12. Which command can be used to view the contents of knife-config gem ?
Ans. chef gem content knife-config
13. Which command is used to generate a delivery configuration file and build cookbook ?
Ans. chef generate build-cookbook COOKBOOK_PATH/COOKBOOK_NAME
14. Which command is used to generate a custom resource in the /resources directory ?
Ans. chef generate resource COOKBOOK_PATH NAME
15. Which command can be used to create a chef repo ?
Ans. chef generate repo REPO_NAME
16. Which command is used to generate a nodes-oriented report for Chef environment ?
Ans. chef report nodes
17. Which command can be used to generate a cookbook-oriented report for your chef Infra ?
Ans. chef report cookbooks
18. Which command is used to recover a deleted policy or policy group ?
Ans. chef undelete
19. Which command is used to publish a policy archive file to the Chef Infra Server ?
Ans. chef push-archive POLICY_GROUP ARCHIVE_FILE
20. Which command is used to display revisions for every Policyfile.rb file that is
on the Chef Infra Server ?
Ans. chef show-policy POLICY_NAME POLICY_GROUP
21. Which command is used to display an itemized comparison of two versions of a Policyfile.lock.json file ?
Ans. chef diff POLICY_FILE --head | --git POLICY_GROUP | POLICY_GROUP...POLICY_GROUP (options)
22. Which command is used to delete the named policy group from the Chef Infra Server ?
Ans. chef delete-policy-group
23. Which command is used to delete orphaned policy revisions to Policyfile files from Chef Infra Server ?
Ans. chef clean-policy-revisions
24. How to view the list of orphaned policy revisions ?
Ans. chef show-policy --orphans
25. How to apply a policy locally on a machine ?
Ans. chef-client -z
26. Which command is used to set the Ruby included in Chef Workstation as the System Ruby ?
Ans. chef shell-init
27. Which command is used to generate a template in the /templates directory ?
Ans. chef generate template COOKBOOK_PATH NAME
28. Which command is used to generate a recipe in the /recipes directory ?
Ans. chef generate recipe COOKBOOK_PATH NAME
29. Which command is used to capture a node's state as a local chef-repo ?
Ans. chef capture NODE-NAME
30. Which command is used to generate a file to be used with Policyfile ?
Ans. chef generate policyfile POLICY_NAME
31. How to remove chef automate from your System ?
Ans. chef-automate uninstall
32. How to reset a lost, forgotten or compromised admin password ?
Ans. chef-automate iam admin-access restore NEW_PASSWORD
33. Which directory is used to store validation key files ?
Ans. .chef hidden directory
34. Which directory is used to store the cookbooks that Chef Infra Client Uses ?
Ans. cookbooks/
35. Which directory is used to store all of the data bags that exist for an Organization ?
Ans. data_bags/