In this article, I will take you through 31 Best Chef Interview Questions.Chef is a very frequently used tool in Automation and DevOps Platform. So it is very imperative to know about Frequently asked Chef Interview Questions for those who is looking to build his career in DevOps Platform. Here we will go through best chef interview questions which has been asked in many interviews.
Chef Interview Questions
Also Read: How to Install Chef 13 on RedHat/CentOS 7
1. How to create a new role in Chef ?
Ans. knife role create -d <role_name>
2. How to see all the Chef roles ?
Ans. knife role list
3. What is the meaning of -d in knife role create -d <role_name> command ?
Ans. This option tells to skip the opening of the editor and accept all the default values.
4. How do you download cookbook in Chef ?
Ans. knife cookbook site download <cookbook_name>
5. Which command can be used to edit Chef Roles ?
Ans. knife role edit <role_name>
6. What are the sources components constitutes the run list ?
Ans. Four Components constitute the run list as whole:-
7. What is the order of precedence during computation of hashes ?
Ans. It will be in below order:-
8. Why do we require data bags when we already have attribute data ?
Ans. Attribute data represents the state of the node at the time the client is being run but the data bags contains free form data which is not attached to any role or cookbook or a node.It can be used anywhere for any requirements.
9. Which command is used for converging a node ?
10. What is Cookbook ?
Ans. Cookbook is a list of recipes in a proper order to manage the resources in an Infrastructure applied in a Certain way.
11. Which tool can be used to bootstrap the chef server configuration ?
12. Which command is used to check the status of services ?
Ans. chef-server-ctl status
13. What is the command to list all the installed cookbooks ?
Ans. knife cookbook list
14. What is the command to upload cookbook to the chef Service ?
Ans. knife cookbook upload
15. Which template language is used by Chef to generate configuration files ?
Ans. ERB template language which is a Ruby based template language.
16. Why Chef uses Ruby based ERB Template language ?
Ans.It is because ERB is widely available and requires no extra dependencies.
17. What are the three key attributes of the template resource ?
Ans. Path,Source and Variables
18. How to install ChefSpec through gem ?
Ans. gem install chefspec
19. Which tool can be used to manage gem versions ?
20. How to install bundler through gem ?
Ans. gem install bundler
21. How to run tests using rspec application ?
Ans. bundle exec rspec <test_file>
22. How to use custom json data in Chef Cookbook ?
Ans. By setting json property
23. How to provide a customer node name using Chef Cookbook ?
Ans. By setting node_name property.
24. How to use chef-shell as a chef-solo client ?
Ans. By using -s option with chef-shell
25. How to enable client mode in Chef ?
Ans. By using -z or –client flag
26. How to activate recipe mode in Chef Shell ?
Ans. By typing recipe_mode
27. How to run recipe from Chef Shell ?
Ans. By running run_chef
28. How to interact with currently defined attribute in Chef ?
Ans. By enabling attribute mode
29. How to enable attribute mode in Chef Shell ?
Ans. By running attributes_mode
30. How to set attributes in Chef ?
Ans. By using set command
31. How to install chef using gem ?
Ans. gem install chef
Also Read: Chef: Powerful Infrastructure Automation