{"id":26880,"date":"2022-02-16T06:14:09","date_gmt":"2022-02-16T06:14:09","guid":{"rendered":"https:\/\/www.devopsschool.com\/blog\/?p=26880"},"modified":"2022-04-13T16:57:10","modified_gmt":"2022-04-13T16:57:10","slug":"top-50-chef-interview-questions-and-answers","status":"publish","type":"post","link":"https:\/\/www.devopsschool.com\/blog\/top-50-chef-interview-questions-and-answers\/","title":{"rendered":"Top 50 Chef interview questions and answers"},"content":{"rendered":"\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2022\/02\/chef-1.jpeg\" alt=\"\" class=\"wp-image-26882\" width=\"661\" height=\"333\" srcset=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2022\/02\/chef-1.jpeg 625w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2022\/02\/chef-1-300x151.jpeg 300w\" sizes=\"auto, (max-width: 661px) 100vw, 661px\" \/><figcaption><em>Chef<\/em><\/figcaption><\/figure><\/div>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"1-q-what-is-a-resource\">1.Q) What Is A Resource?<\/h2>\n\n\n\n<p><br>Ans: A resource represents a piece of infrastructure and its desired state, such as a package that should be installed, a service that should be running, or a file that should be generated.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"2-q-what-is-a-recipe\">2.Q) What Is A Recipe?<\/h2>\n\n\n\n<p><br>Ans: A recipe is a collection of resources that describes a particular configuration or policy. A recipe describes everything that is required to configure part of a system. Recipes do things such as:<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">Install and configure software components.\nManage files.\nDeploy applications.\nExecute other recipes.<\/code><\/span><\/pre>\n\n\n<h2 class=\"wp-block-heading\" id=\"3-q-what-happens-when-you-don-t-specify-a-resource-s-action\">3.Q) What Happens When You Don\u2019t Specify A Resource\u2019s Action?<\/h2>\n\n\n\n<p><br>Ans: When you don\u2019t specify a resource\u2019s action, Chef applies the default action.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"4-q-write-a-service-resource-that-stops-and-then-disables-the-httpd-service-from-starting-when-the-system-boots\">4.Q) Write A Service Resource That Stops And Then Disables The Httpd Service From Starting When The System Boots?<\/h2>\n\n\n\n<p><br>Ans:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript\">Service \u2018httpd\u2019 <span class=\"hljs-keyword\">do<\/span>\nAction\nEnd<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h2 class=\"wp-block-heading\" id=\"5-q-how-does-a-cookbook-differ-from-a-recipe\">5.Q) How Does A Cookbook Differ From A Recipe?<\/h2>\n\n\n\n<p><br>Ans: A recipe is a collection of resources, and typically configures a software package or some piece of infrastructure. A cookbook groups together recipes and other information in a way that is more manageable than having just recipes alone. For example, in this lesson you used a template resource to manage your HTML home page from an external file. The recipe stated the configuration policy for your web site, and the template file contained the data. You used a cookbook to package both parts up into a single unit that you can later deploy.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"6-q-how-does-chef-apply-differ-from-chef-client\"><br>6.Q) How Does Chef-apply Differ From Chef-client?<\/h2>\n\n\n\n<p><br>Ans: Chef-apply apply a single recipe; chef-client applies a cookbook. For learning purposes, we had you start off with chef-apply because it helps you understand the basics quickly. In practice, chef-apply is useful when you want to quickly test something out. But for production purposes, you typically run chef-client to apply one or more cookbooks.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"7-q-what-s-the-run-list\"><br>7.Q) What\u2019s The Run-list?<\/h2>\n\n\n\n<p><br>Ans: The run-list lets you specify which recipes to run, and the order in which to run them. The run-list is important for when you have multiple cookbooks, and the order in which they run matters.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"q-what-are-the-two-ways-to-set-up-a-chef-server-ans\"><br>8.Q) What Are The Two Ways To Set Up A Chef Server?<br><\/h2>\n\n\n\n<p id=\"q-what-are-the-two-ways-to-set-up-a-chef-server-ans\">Ans:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\">Install an instance on your own infrastructure.\n<span class=\"hljs-keyword\">Use<\/span> <span class=\"hljs-title\">hosted<\/span> <span class=\"hljs-title\">Chef<\/span>.<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h2 class=\"wp-block-heading\" id=\"9-q-what-s-the-role-of-the-starter-kit\">9.Q) What\u2019s The Role Of The Starter Kit?<\/h2>\n\n\n\n<p><br>Ans: The Starter Kit provides certificates and other files that enable you to securely communicate with the Chef server.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"10-q-what-is-a-node\"><br>10.Q) What Is A Node?<\/h2>\n\n\n\n<p><br>Ans: A node represents a server and is typically a virtual machine, container instance, or physical server \u2013 basically any compute resource in your infrastructure that\u2019s managed by Chef.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"11-q-what-information-do-you-need-to-in-order-to-bootstrap\"><br>11.Q) What Information Do You Need To In Order To Bootstrap?<\/h2>\n\n\n\n<p><br>Ans: You need:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-3\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\">Your node\u2019s host name <span class=\"hljs-keyword\">or<\/span> <span class=\"hljs-keyword\">public<\/span> IP address.\nA user name <span class=\"hljs-keyword\">and<\/span> password you can log on to your node with.\nAlternatively, you can <span class=\"hljs-keyword\">use<\/span> <span class=\"hljs-title\">key<\/span>-<span class=\"hljs-title\">based<\/span> <span class=\"hljs-title\">authentication<\/span> <span class=\"hljs-title\">instead<\/span> <span class=\"hljs-title\">of<\/span> <span class=\"hljs-title\">providing<\/span> <span class=\"hljs-title\">a<\/span> <span class=\"hljs-title\">user<\/span> <span class=\"hljs-title\">name<\/span> <span class=\"hljs-title\">and<\/span> <span class=\"hljs-title\">password<\/span>.<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-3\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h2 class=\"wp-block-heading\" id=\"12-q-what-happens-during-the-bootstrap-process\">12.Q) What Happens During The Bootstrap Process?<\/h2>\n\n\n\n<p><br>Ans: During the bootstrap process, the node downloads and installs chef-client, registers itself with the Chef server, and does an initial check in. During this check in, the node applies any cookbooks that are part of its run-list.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"13-q-which-of-the-following-lets-you-verify-that-your-node-has-successfully-bootstrapped\"><br>13.Q) Which Of The Following Lets You Verify That Your Node Has Successfully Bootstrapped?<br><\/h2>\n\n\n\n<p>Ans:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-4\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\">The Chef management console.\nKnife node <span class=\"hljs-keyword\">list<\/span>\nKnife node show\nYou can <span class=\"hljs-keyword\">use<\/span> <span class=\"hljs-title\">all<\/span> <span class=\"hljs-title\">three<\/span> <span class=\"hljs-title\">of<\/span> <span class=\"hljs-title\">these<\/span> <span class=\"hljs-title\">methods<\/span>.<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-4\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h2 class=\"wp-block-heading\" id=\"14-q-what-is-the-command-you-use-to-upload-a-cookbook-to-the-chef-server\">14.Q) What Is The Command You Use To Upload A Cookbook To The Chef Server?<\/h2>\n\n\n\n<p><br>Ans: Knife cookbook upload.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"15-q-how-do-you-apply-an-updated-cookbook-to-your-node\"><br>15.Q) How Do You Apply An Updated Cookbook To Your Node?<\/h2>\n\n\n\n<p><br>Ans: We mentioned two ways. Run knife Ssh from your workstation. SSH directly into your server and run chef-client. You can also run chef-client as a daemon, or service, to check in with the Chef server on a regular interval, say every 15 or 30 minutes. Update your Apache cookbook to display your node\u2019s host name, platform, total installed memory, and number of CPUs in addition to its FQDN on the home page. Update index.html.erb like this. hello from &lt;%= node %&gt;&lt; \/h1&gt; &lt;%= node %&gt; &lt;%= node %&gt; \u2013 &lt;%= node %&gt;<\/p>\n\n\n\n<p>&lt;%= node %&gt; RAM<\/p>\n\n\n\n<p>&lt;%= node %&gt; CPUs<\/p>\n\n\n\n<p>Then upload your cookbook and run it on your node.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"16-q-what-would-you-set-your-cookbook-s-version-to-once-it-s-ready-to-use-in-production\"><br>16.Q) What Would You Set Your Cookbook\u2019s Version To Once It\u2019s Ready To Use In Production?<\/h2>\n\n\n\n<p><br>Ans: According to Semantic Versioning, you should set your cookbook\u2019s version number to 1.0.0 at the point it\u2019s ready to use in production.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"17-q-create-a-second-node-and-apply-the-awesome-customers-cookbook-to-it-how-long-does-it-take\"><br>17.Q) Create A Second Node And Apply The Awesome Customers Cookbook To It. How Long Does It Take?<\/h2>\n\n\n\n<p><br>Ans: You already accomplished the majority of the tasks that you need. You wrote the awesome customers cookbook, uploaded it and its dependent cookbooks to the Chef server, applied the awesome customers cookbook to your node, and verified that everything\u2019s working. All you need to do now is:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-5\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\">Bring up a second Red Hat Enterprise Linux <span class=\"hljs-keyword\">or<\/span> Centos node.\nCopy your secret key file to your second node.\nBootstrap your node the same way <span class=\"hljs-keyword\">as<\/span> before. Because you <span class=\"hljs-keyword\">include<\/span> the awesome customers cookbook in your run-<span class=\"hljs-keyword\">list<\/span>, your node will apply that cookbook during the bootstrap process.\nThe result is a second node that\u2019s configured identically to the first one. The process should take far less time because you already did most of the work.\nNow when you fix an issue <span class=\"hljs-keyword\">or<\/span> add a <span class=\"hljs-keyword\">new<\/span> feature, you\u2019ll be able to deploy <span class=\"hljs-keyword\">and<\/span> verify your update much more quickly!<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-5\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h2 class=\"wp-block-heading\" id=\"18-q-what-s-the-value-of-local-development-using-test-kitchen-ans-local-development-with-test-kitchen\">18.Q) What\u2019s The Value Of Local Development Using Test Kitchen? Ans: Local development with Test Kitchen:<\/h2>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-6\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\">Enables you to <span class=\"hljs-keyword\">use<\/span> <span class=\"hljs-title\">a<\/span> <span class=\"hljs-title\">variety<\/span> <span class=\"hljs-title\">of<\/span> <span class=\"hljs-title\">virtualization<\/span> <span class=\"hljs-title\">providers<\/span> <span class=\"hljs-title\">that<\/span> <span class=\"hljs-title\">create<\/span> <span class=\"hljs-title\">virtual<\/span> <span class=\"hljs-title\">machine<\/span> <span class=\"hljs-title\">or<\/span> <span class=\"hljs-title\">container<\/span> <span class=\"hljs-title\">instances<\/span> <span class=\"hljs-title\">locally<\/span> <span class=\"hljs-title\">on<\/span> <span class=\"hljs-title\">your<\/span> <span class=\"hljs-title\">workstation<\/span> <span class=\"hljs-title\">or<\/span> <span class=\"hljs-title\">in<\/span> <span class=\"hljs-title\">the<\/span> <span class=\"hljs-title\">cloud<\/span>.\n<span class=\"hljs-title\">Enables<\/span> <span class=\"hljs-title\">you<\/span> <span class=\"hljs-title\">to<\/span> <span class=\"hljs-title\">run<\/span> <span class=\"hljs-title\">your<\/span> <span class=\"hljs-title\">cookbooks<\/span> <span class=\"hljs-title\">on<\/span> <span class=\"hljs-title\">servers<\/span> <span class=\"hljs-title\">that<\/span> <span class=\"hljs-title\">resemble<\/span> <span class=\"hljs-title\">those<\/span> <span class=\"hljs-title\">that<\/span> <span class=\"hljs-title\">you<\/span> <span class=\"hljs-title\">use<\/span> <span class=\"hljs-title\">in<\/span> <span class=\"hljs-title\">production<\/span>.\n<span class=\"hljs-title\">Speeds<\/span> <span class=\"hljs-title\">up<\/span> <span class=\"hljs-title\">the<\/span> <span class=\"hljs-title\">development<\/span> <span class=\"hljs-title\">cycle<\/span> <span class=\"hljs-title\">by<\/span> <span class=\"hljs-title\">automatically<\/span> <span class=\"hljs-title\">provisioning<\/span> <span class=\"hljs-title\">and<\/span> <span class=\"hljs-title\">tearing<\/span> <span class=\"hljs-title\">down<\/span> <span class=\"hljs-title\">temporary<\/span> <span class=\"hljs-title\">instances<\/span>, <span class=\"hljs-title\">resolving<\/span> <span class=\"hljs-title\">cookbook<\/span> <span class=\"hljs-title\">dependencies<\/span>, <span class=\"hljs-title\">and<\/span> <span class=\"hljs-title\">applying<\/span> <span class=\"hljs-title\">your<\/span> <span class=\"hljs-title\">cookbooks<\/span> <span class=\"hljs-title\">to<\/span> <span class=\"hljs-title\">your<\/span> <span class=\"hljs-title\">instances<\/span>.<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-6\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h2 class=\"wp-block-heading\" id=\"19-q-what-are-the-responsibilities-of-system-administrators-in-an-organization\">19.Q) What are the responsibilities of system administrators in an organization?<\/h2>\n\n\n\n<p>Answer: System administrator is responsible for effective planning, installation, configuration, and optimizing the IT infrastructure to achieve high availability and performance.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"20-q-what-do-you-mean-by-it-infrastructure\">20.Q) What do you mean by IT infrastructure?<\/h2>\n\n\n\n<p>Answer: IT infrastructure includes all the physical hardware such as systems, servers, network systems, switch, routers, legacy interfaces and facilities like data centers, data storage, and its retrieval and all the elements that are utilized to manage and use data and information securely to protect business goals of an organization.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"21-q-explain-about-chef-desktop\">21.Q) Explain about Chef Desktop<\/h2>\n\n\n\n<p>Answer: It helps control IT resources like laptops, desktops, and kiosk workstations remotely from a centralized location. It automates deployment, management, and secures the maintenance of IT resources. It automates tasks such as implementing policy-driven configuration and eliminates manual time-consuming processes.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"22-q-what-are-the-features-of-chef-compliance\">22.Q) What are the features of Chef Compliance?<\/h2>\n\n\n\n<p>Answer: Chef Compliance helps enforce and maintain compliances and prevent security incidents with standard audit and remediation content across heterogeneous estates to provide visibility and control across hybrid and multi-cloud environments.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"23-q-how-chef-infra-is-used-by-the-devops-team-in-infrastructure-management\">23.Q) How Chef Infra is used by the DevOps team in Infrastructure management?<\/h2>\n\n\n\n<p>Answer: Chef Infra automates configuration of infrastructure, ensures consistent, correct, flexible, testable, versionable, and human-readable configuration policy, and any modification in configuration will be applied universally across the entire infrastructure.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"24-q-explain-the-features-of-chef-habitat\">24.Q) Explain the features of Chef Habitat.<\/h2>\n\n\n\n<p>Answer: It offers automation in defining, packaging, and delivering applications to any environment, irrespective of deployment platform or operating system. It creates deployable artifacts for virtual machines or containers without refactoring or rewriting. It also helps scale the adoption of agile delivery practices across operations and development.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"25-q-explain-the-importance-of-chef-inspec-in-compliance-with-automation\">25.Q) Explain the importance of Chef Inspec in compliance with automation.<\/h2>\n\n\n\n<p>Answer: Chef Inspec provides security and compliance rules across security engineers, operations, and software developers. It enforces consistent standards in the managed environment and in each stage of development by running automated tests for compliance, security, and other policy requirements across servers, containers, and cloud APIs.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"26-q-explain-the-use-of-recipe-in-chef\">26.Q) Explain the use of Recipe in Chef.<\/h2>\n\n\n\n<p>Answer: Recipe is a collection of resources that decides the policy or configuration of a node. To run a recipe, it must reside on the node\u2019s run list. They are created using Ruby and have all the instructions about everything that is required to run, update, or create on Chef Client\u2019s node.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"27-q-what-does-a-node-represent-in-chef\">27.Q) What does a Node represent in Chef?<\/h2>\n\n\n\n<p>Answer: Node can be any device, physical, virtual, cloud, or network device managed by Chef Infra.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-7\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript\">Physical node can be either an on-premise server or a virtual machine connected to a network and can send, receive, and forward the information over the Internet.\nVirtual node is a physical machine that runs <span class=\"hljs-keyword\">as<\/span> software implementation.\nCloud-based node is an external cloud-based service that is hosted <span class=\"hljs-keyword\">with<\/span> Amazon web services, Google Cloud Platform, or Microsoft Azure. Chef Infra client is installed to deploy, maintain, or configure these instances created <span class=\"hljs-keyword\">with<\/span> plug-<span class=\"hljs-keyword\">in<\/span> <span class=\"hljs-keyword\">with<\/span> the help <span class=\"hljs-keyword\">of<\/span> the knife tool.\nNetwork node is a network device such <span class=\"hljs-keyword\">as<\/span> a <span class=\"hljs-keyword\">switch<\/span>, a router, connected to physical or logical Ethernet and VLANs, <span class=\"hljs-keyword\">for<\/span> Chef to automate common network configurations.<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-7\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h2 class=\"wp-block-heading\" id=\"28-q-what-is-the-role-of-ohai-in-chef\">28.Q) What is the role of OHAI in Chef?<\/h2>\n\n\n\n<p>Answer: OHAI is a tool that Chef Infra runs and collects system configuration data used within Cookbooks. It detects common configuration details with help of built-in plug-in. It also collects attributes from Operating System, Network, Memory, Disk, CPU, Kernel, Hostnames, and Cloud provider metadata.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"29-q-explain-the-use-of-knife-in-chef\">29.Q) Explain the use of Knife in Chef.<\/h2>\n\n\n\n<p>Answer: Knife is a command-line tool that acts as an interface between Chef Workstation and Chef Server where it helps Chef Workstation to communicate the content of its chef-repo directory with a Chef Server. Chef-Workstation contains the chef-repo directory where cookbooks, roles, data bags, and environments are stored.<\/p>\n\n\n\n<p>With Knife commands users can manage (create, delete, edit, list, show) nodes, roles, JSON data storage, environments, cookbooks and recipes, cloud resources using Knife plug-ins.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"30-q-explain-dpkg-package-resource\">30.Q) Explain dpkg_package resource.<\/h2>\n\n\n\n<p>Answer: To manage packages for dpkg platform, on a node, dpkg program from the Debian package applies to install, remove, and retrieve information about .deb packages. Various actions such as :install, :nothing, :remove of dpkg_package resource are used to manage Debian package.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"31-q-list-types-of-handlers-in-chef\">31.Q) List types of handlers in Chef.<\/h2>\n\n\n\n<p>Answer: \u2018Chef_handler\u2019 resource makes sure that all the handlers are enabled and are available for Chef Infra Client run. The Chef handlers are of three types.<\/p>\n\n\n\n<p>These are listed below:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-8\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\"><span class=\"hljs-keyword\">Exception<\/span> Handler\nReport Handler\nStart Handler<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-8\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h2 class=\"wp-block-heading\" id=\"32-q-explain-the-exception-handler-in-chef\">32.Q) Explain the Exception handler in Chef.<\/h2>\n\n\n\n<p>Answer: When Chef Infra client fails while running, this handler can be used at Chef Infra Client run where a recipe containing chef handler resource is added to node\u2019s run-list. Exception handler runs with run_status object, returning its property value for \u2018failed?\u2019 as true.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"33-q-explain-report-handler-in-chef\">33.Q) Explain Report handler in Chef.<\/h2>\n\n\n\n<p>Answer: When Chef Infra Client runs successfully, sending a report on this run, we can use this handler. A recipe containing chef handler resource is used to run a list of the node. Report handler runs with run_status object returning its property value for \u2018success?\u2019 as true.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"34-q-explain-start-handler-in-chef\">34.Q) Explain Start handler in Chef.<\/h2>\n\n\n\n<p>Answer: As the name suggests, these handlers are applied in the client.rb setting while starting Chef Infra Client, to run events, or by applying gem resources that are available in chef-client cookbook recipe.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"35-q-explain-handler-dsl-in-chef\">35.Q) Explain Handler DSL in Chef.<\/h2>\n\n\n\n<p>Answer: Events like sending email when Chef Infra Client run fails, or updation of aggregating statistics about resources during Chef Infra Client runs to StatsD, Handler DSL is used to attach a callback to such events.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"36-q-explain-run-list-in-chef\">36.Q) Explain Run-list in Chef.<\/h2>\n\n\n\n<p>Answer: Run-list contains information required by Chef to configure a node in the desired state. Run-list has a list of roles, recipes, or both, which is run in the exact order they are listed in it. They are stored on Chef Server as a part of a node object, maintained using a knife uploaded from the Chef workstation. Run-list formats are fully qualified, cookbook, or default.<\/p>\n\n\n\n<p>Example: \u201crole[role_name]\u201d, or \u201crecipe[COOKBOOK::RECIPE_NAME]\u201d<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"37-q-what-details-are-required-to-bootstrap-a-node-in-chef\">37.Q) What details are required to bootstrap a node in Chef.<\/h2>\n\n\n\n<p>Answer: Following are a mandatory requirement:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-9\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\">Username <span class=\"hljs-keyword\">and<\/span> password <span class=\"hljs-keyword\">as<\/span> login credentials into a specific node.\n<span class=\"hljs-keyword\">Public<\/span> IP address <span class=\"hljs-keyword\">or<\/span> Hostname of the node.\nKey-based authentication, in place of username <span class=\"hljs-keyword\">and<\/span> password credentials.<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-9\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h2 class=\"wp-block-heading\" id=\"38-q-explain-ways-to-apply-an-updated-cookbook-in-chef-to-a-node\">38.Q) Explain ways to apply an updated Cookbook in Chef to a node.<\/h2>\n\n\n\n<p>Answer: There are three possible ways of applying an updated Cookbook to a node in a Chef.<\/p>\n\n\n\n<p>These are:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-10\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript\">Running knife ssh subcommand to invoke SSH commands <span class=\"hljs-keyword\">from<\/span> the workstation.\nRunning Chef-client command to direct ssh connection into the server.\nRunning Chef-client <span class=\"hljs-keyword\">as<\/span> a daemon or a service <span class=\"hljs-keyword\">in<\/span> order to regularly review Chef Server.<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-10\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h2 class=\"wp-block-heading\" id=\"39-q-what-is-test-kitchen\">39.Q) What is Test Kitchen?<\/h2>\n\n\n\n<p>Answer: Test kitchen is a built-in tool that tests the recipe \u2013 (code to configure an infrastructure), in an isolated environment, for any potential defects, that may change the production environment. It allows testing code to configure infrastructure over any platform or operating system using Chef Inspec.<\/p>\n\n\n\n<p>With Test Kitchen, cookbook data can be verified across any combination of platforms and test suites, kitchen.yml file gets created. Multiple kitchen instances can be created with this yml file.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"40-q-how-important-is-it-to-install-ssl-certificates-in-chef\">40.Q) How important is it to install SSL certificates in Chef?<\/h2>\n\n\n\n<p>Answer: SSL certificate is a digital signature or authentication for a website, and provides an encrypted connection, which will secure our website from the hacker\u2019s attack with the intension to access sensitive data. It helps to create private keys and ensures secured data transmission between Chef Server and Chef Client.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"41-q-what-is-ssl-cert-file-in-chef\">41.Q) What is SSL_CERT_FILE in chef?<\/h2>\n\n\n\n<p>Ans: Use the SSL_CERT_FILE environment variable to specify the location for the SSL certificate authority (CA) bundle that is used by the chef-client.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"42-q-what-is-knife-ssl-check-command-in-chef\">42.Q) What is knife ssl check command in chef?<\/h2>\n\n\n\n<p>Ans: Run the knife ssl check subcommand to verify the state of the SSL certificate, and then use the response to help troubleshoot issues that may be present.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"43-q-what-is-the-chef-resources-file\">43.Q) What is the chef resources file?<\/h2>\n\n\n\n<p>Ans: A file resource is used to manage files directly on a node.<\/p>\n\n\n\n<p>A file resource block manages files that exist on nodes. For example, to write the home page for an Apache website:<\/p>\n\n\n\n<p>file \u2018\/var\/www\/customers\/public_html\/index.php\u2019 do content \u2018This is a placeholder for the home page.\u2019 mode \u20180755\u2019 owner \u2018web_admin\u2019 group \u2018web_admin\u2019 end<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"44-q-what-is-data-bags\"><br>44.Q) What is Data Bags?<\/h2>\n\n\n\n<p>Ans: A data bag is a global variable that is stored as JSON data and is accessible from a Chef server. A data bag is indexed for searching and can be loaded by a recipe or accessed during a search.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"45-q-what-is-chef-acl-resource-in-chef\"><br>45.Q) What is chef_acl resource in chef?<\/h2>\n\n\n\n<p>Ans: Use the chef_acl resource to interact with access control lists (ACLs) that exist on the Chef server.<\/p>\n\n\n\n<p>Syntax: The syntax for using the chef_acl resource in a recipe is as follows:<\/p>\n\n\n\n<p>chef_acl \u2018name\u2019 do attribute \u2018value\u2019 # see properties section below \u2026 action :action # see actions section below end<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"46-q-what-information-do-you-need-in-order-to-bootstrap-in-chef\">46.Q) What information do you need in order to bootstrap in Chef?<\/h2>\n\n\n\n<p>Ans: Just mention the information you need in order to bootstrap:<\/p>\n\n\n\n<p>Your node\u2019s hostname or public IP address.<\/p>\n\n\n\n<p>A user name and password you can log on to your node with.<\/p>\n\n\n\n<p>Alternatively, you can use key-based authentication instead of providing a user name and password.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"47-q-what-is-the-command-you-use-to-upload-a-cookbook-to-the-chef-server\"><br>47.Q) What is the command you use to upload a cookbook to the Chef server?<\/h2>\n\n\n\n<p>Ans: You can directly mention the command to upload a cookbook to the Chef server \u201cknife cookbook upload\u201d.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"48-q-what-is-the-run-list-in-chef\"><br>48.Q) What is the run-list in Chef?<\/h2>\n\n\n\n<p>Ans: run-list lets you specify which Recipes to run, and the order in which to run them. The run-list is important when you have multiple Cookbooks and the order in which they run matters.<\/p>\n\n\n\n<p>Depending on the discussion if you think more explanation is required just mention the below points<\/p>\n\n\n\n<p>A run-list is:<\/p>\n\n\n\n<p>An ordered list of roles and\/or recipes that are run in the exact order defined in the run-list; if a recipe appears more than once in the run-list, the chef-client will not run it twice.<\/p>\n\n\n\n<p>Always specific to the node on which it runs; nodes may have a run-list that is identical to the run-list used by other nodes.<\/p>\n\n\n\n<p>Stored as part of the node object on the Chef server.<\/p>\n\n\n\n<p>Maintained using a knife, and then uploaded from the workstation to the Chef server, or is maintained using the Chef management console.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"49-q-how-do-you-apply-an-updated-cookbook-to-your-node-in-chef\"><br>49.Q) How do you apply an updated Cookbook to your node in Chef?<\/h2>\n\n\n\n<p>Ans: There are three ways to apply an updated Cookbook to a node you can mention all or anyone, I will suggest you mention all three:<\/p>\n\n\n\n<p>-Run knife ssh from your workstation.<\/p>\n\n\n\n<p>-SSH directly into your server and run the chef-client.<\/p>\n\n\n\n<p>-You can also run chef-client as a daemon, or service, to check in with the Chef server on a regular interval, say every 15 or 30 minutes.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"50-q-write-a-service-resource-that-stops-and-then-disables-the-httpd-service-from-starting-when-the-system-boots-in-chef\"><br>50.Q) Write a service Resource that stops and then disables the httpd service from starting when the system boots in Chef?<\/h2>\n\n\n\n<p>Ans: Use the below Resource to stop and disable the httpd service from starting when system boots.<\/p>\n\n\n\n<p>service &#8216;httpd&#8217; do action [:stop, :disable] end<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"related-video\">Related video: <\/h4>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe loading=\"lazy\"  id=\"_ytid_10477\"  width=\"760\" height=\"427\"  data-origwidth=\"760\" data-origheight=\"427\" src=\"https:\/\/www.youtube.com\/embed\/BadwcYVeYEA?enablejsapi=1&#038;autoplay=0&#038;cc_load_policy=0&#038;cc_lang_pref=&#038;iv_load_policy=1&#038;loop=0&#038;rel=1&#038;fs=1&#038;playsinline=0&#038;autohide=2&#038;theme=dark&#038;color=red&#038;controls=1&#038;disablekb=0&#038;\" class=\"__youtube_prefs__  epyt-is-override  no-lazyload\" title=\"YouTube player\"  allow=\"fullscreen; accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen data-no-lazy=\"1\" data-skipgform_ajax_framebjll=\"\"><\/iframe>\n<\/div><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>1.Q) What Is A Resource? Ans: A resource represents a piece of infrastructure and its desired state, such as a package that should be installed, a service that should be&#8230; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_joinchat":[],"footnotes":""},"categories":[88,52],"tags":[310,568,407,4906,282,3357,585,1072,221,766,3347,3380,1173,1543,843,637,381],"class_list":["post-26880","post","type-post","status-publish","format-standard","hentry","category-chef","category-interview-questions-answers","tag-application","tag-bootstrap","tag-chef","tag-chef-compliance","tag-configuration","tag-deploy","tag-development","tag-environment","tag-infrastructure","tag-interview","tag-interview-questions-answers","tag-it-infrastructure","tag-knife","tag-node","tag-organization","tag-top","tag-version"],"_links":{"self":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/26880","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/comments?post=26880"}],"version-history":[{"count":3,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/26880\/revisions"}],"predecessor-version":[{"id":26898,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/26880\/revisions\/26898"}],"wp:attachment":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media?parent=26880"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/categories?post=26880"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/tags?post=26880"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}