{"id":673,"date":"2017-07-26T07:15:23","date_gmt":"2017-07-26T07:15:23","guid":{"rendered":"http:\/\/www.scmgalaxy.com\/tutorials\/2017\/07\/26\/chef-internal-how-chef-maintain-the-state-of-each-resources-internally\/"},"modified":"2021-11-19T05:56:01","modified_gmt":"2021-11-19T05:56:01","slug":"chef-internal-how-chef-maintain-the-state-of-each-resources-internally","status":"publish","type":"post","link":"https:\/\/www.devopsschool.com\/blog\/chef-internal-how-chef-maintain-the-state-of-each-resources-internally\/","title":{"rendered":"Chef Internal &#8211; How Chef maintain the state of each resources internally?"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-2870 aligncenter\" src=\"http:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2017\/07\/chef-internal.png\" alt=\"chef-internal\" width=\"600\" height=\"400\" srcset=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2017\/07\/chef-internal.png 600w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2017\/07\/chef-internal-300x200.png 300w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/p>\n<p style=\"box-sizing: border-box; margin: 0px 0px 0.5em; padding: 0px; border: 0px; font-variant-numeric: inherit; font-stretch: inherit; font-size: 14px; line-height: inherit; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; color: #3f5364;\"><strong>Chef Client<\/strong><\/p>\n<p>A chef-client is an agent that runs locally on every node that is under management by Chef. The chef-client executable can be run as a daemon. When a chef-client is run, it will perform all of the steps that are required to bring the node into the expected state, including:<\/p>\n<ul class=\"simple\" style=\"box-sizing: border-box; color: #3f5364; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px;\">\n<li style=\"box-sizing: border-box;\">Registering and authenticating the node with the Chef server<\/li>\n<li style=\"box-sizing: border-box;\">Building the node object<\/li>\n<li style=\"box-sizing: border-box;\">Synchronizing cookbooks<\/li>\n<li style=\"box-sizing: border-box;\">Compiling the resource collection by loading each of the required cookbooks, including recipes, attributes, and all other dependencies<\/li>\n<li style=\"box-sizing: border-box;\">Taking the appropriate and required actions to configure the node<\/li>\n<li style=\"box-sizing: border-box;\">Looking for exceptions and notifications, handling each as required<\/li>\n<\/ul>\n<p><span style=\"color: #3f5364; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;\"><span style=\"font-size: 14px;\">RSA public key-pairs are used to authenticate the chef-client with the Chef server every time a chef-client needs access to data that is stored on the Chef server. This prevents any node from accessing data that it shouldn\u2019t and it ensures that only nodes that are properly registered with the Chef server can be managed.<\/span><\/span><\/p>\n<p><strong style=\"color: #3f5364; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px;\">Ohai<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"color: #3f5364; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; box-sizing: border-box; margin: 0px 0px 0.5em; padding: 0px; border: 0px; font-variant-numeric: inherit; font-stretch: inherit; line-height: inherit;\">Ohai is a tool that is used to collect system configuration data, which is provided to the chef-client for use within cookbooks. Ohai is run by the chef-client at the beginning of every Chef run to determine system state. Ohai includes many built-in plugins to detect common configuration details as well as a plugin model for writing custom plugins.<\/p>\n<p style=\"color: #3f5364; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; box-sizing: border-box; margin: 0px 0px 0.5em; padding: 0px; border: 0px; font-variant-numeric: inherit; font-stretch: inherit; line-height: inherit;\">The types of attributes Ohai collects include but are not limited to:<\/p>\n<ul class=\"simple\" style=\"color: #3f5364; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; box-sizing: border-box;\">\n<li style=\"box-sizing: border-box;\">Operating System<\/li>\n<li style=\"box-sizing: border-box;\">Network<\/li>\n<li style=\"box-sizing: border-box;\">Memory<\/li>\n<li style=\"box-sizing: border-box;\">Disk<\/li>\n<li style=\"box-sizing: border-box;\">CPU<\/li>\n<li style=\"box-sizing: border-box;\">Kernel<\/li>\n<li style=\"box-sizing: border-box;\">Host names<\/li>\n<li style=\"box-sizing: border-box;\">Fully qualified domain names<\/li>\n<li style=\"box-sizing: border-box;\">Virtualization<\/li>\n<li style=\"box-sizing: border-box;\">Cloud provider metadata<\/li>\n<\/ul>\n<p style=\"color: #3f5364; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; box-sizing: border-box; margin: 0px 0px 0.5em; padding: 0px; border: 0px; font-variant-numeric: inherit; font-stretch: inherit; line-height: inherit;\">Attributes that are collected by Ohai are automatic level attributes, in that these attributes are used by the chef-client to ensure that these attributes remain unchanged after the chef-client is done configuring the node.<\/p>\n<p style=\"box-sizing: border-box; margin: 0px 0px 0.5em; padding: 0px; border: 0px; font-variant-numeric: inherit; font-stretch: inherit; line-height: inherit;\"><span style=\"color: #3f5364; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;\"><span style=\"font-size: 14px;\">Ohai collects data for many platforms, including AIX, Darwin, Linux, FreeBSD, OpenBSD, NetBSD, Solaris, and any Microsoft Windows operating systems.<\/span><\/span><\/p>\n<p><span style=\"font-size: 14px;\"><strong><span style=\"color: #3f5364; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;\">Reference<\/span><\/strong><\/span><br>\n<a href=\"https:\/\/docs.chef.io\/chef_client.html\" target=\"_blank\" rel=\"noopener\"><span style=\"color: #3f5364; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;\"><span style=\"font-size: 14px;\">https:\/\/docs.chef.io\/chef_client.html<\/span><\/span><\/a><\/p>\n\n<div class=\"epyt-gallery\" data-currpage=\"1\" id=\"epyt_gallery_23729\"><figure class=\"wp-block-embed wp-block-embed-youtube is-type-video is-provider-youtube epyt-figure\"><div class=\"wp-block-embed__wrapper\"><iframe loading=\"lazy\"  id=\"_ytid_66755\"  width=\"760\" height=\"427\"  data-origwidth=\"760\" data-origheight=\"427\" src=\"https:\/\/www.youtube.com\/embed\/?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__  no-lazyload\" title=\"YouTube player\"  data-epytgalleryid=\"epyt_gallery_23729\"  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><\/div><\/figure><div class=\"epyt-gallery-list\"><div>Sorry, there was a YouTube error.<\/div><\/div><\/div>","protected":false},"excerpt":{"rendered":"<p>Chef Client A chef-client is an agent that runs locally on every node that is under management by Chef. The chef-client executable can be run as a daemon. When a chef-client is run, it will perform all of the steps that are required to bring the node into the expected state, including: Registering and authenticating&#8230;<\/p>\n","protected":false},"author":1,"featured_media":2870,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"_kad_post_classname":"","_joinchat":[],"footnotes":""},"categories":[88],"tags":[407,636,633,602,545,635,634],"class_list":["post-673","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-chef","tag-chef","tag-chef-client","tag-chef-internal","tag-chef-tutorials","tag-how","tag-ohai","tag-resources"],"_links":{"self":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/673","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=673"}],"version-history":[{"count":2,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/673\/revisions"}],"predecessor-version":[{"id":25758,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/673\/revisions\/25758"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media\/2870"}],"wp:attachment":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media?parent=673"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/categories?post=673"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/tags?post=673"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}