{"id":4934,"date":"2018-05-02T09:36:20","date_gmt":"2018-05-02T09:36:20","guid":{"rendered":"http:\/\/www.scmgalaxy.com\/tutorials\/?p=4934"},"modified":"2021-11-17T10:35:41","modified_gmt":"2021-11-17T10:35:41","slug":"how-to-run-chef-client-in-why-run-mode-aka-no-operation","status":"publish","type":"post","link":"https:\/\/www.devopsschool.com\/blog\/how-to-run-chef-client-in-why-run-mode-aka-no-operation\/","title":{"rendered":"How to run chef-client in why-run mode aka \u201cno-operation\u201d"},"content":{"rendered":"<p>why-run mode is a way to see what the chef-client would have configured, had an actual chef-client run occurred. This approach is similar to the concept of \u201cno-operation\u201d (or \u201cno-op\u201d): decide what should be done, but then don\u2019t actually do anything until it\u2019s done right. Run the executable in why-run mode, which is a type of chef-client run that does everything except modify the system.<\/p>\n<p>When why-run mode is enabled, a chef-client run will occur that does everything up to the point at which configuration would normally occur. This includes<\/p>\n<ol>\n<li>Getting the configuration data,<\/li>\n<li>Authenticating to the Chef server,<\/li>\n<li>Rebuilding the node object,<\/li>\n<li>Expanding the run-list,<\/li>\n<li>Getting the necessary cookbook files,<\/li>\n<li>Resetting node attributes,<\/li>\n<li>Identifying the resources, and<\/li>\n<li>Building the resource collection and<\/li>\n<li>Does not include mapping each resource to a provider or configuring any part of the system.<\/li>\n<\/ol>\n<p><strong>How to run chef-client?<\/strong><\/p>\n<p>[code]$ sudo chef-client -o &#8216;recipe[ntp]&#8217; &#8211;why-run<br>\n$ sudo chef-client -o &#8216;recipe[ntp]&#8217; -W[\/code]<\/p>\n<p><a href=\"http:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2018\/05\/chef-why-run-mode-chef-client.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-4935\" src=\"http:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2018\/05\/chef-why-run-mode-chef-client.png\" alt=\"\" width=\"1029\" height=\"569\" srcset=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2018\/05\/chef-why-run-mode-chef-client.png 1029w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2018\/05\/chef-why-run-mode-chef-client-300x166.png 300w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2018\/05\/chef-why-run-mode-chef-client-768x425.png 768w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2018\/05\/chef-why-run-mode-chef-client-1024x566.png 1024w\" sizes=\"auto, (max-width: 1029px) 100vw, 1029px\" \/><\/a><\/p>\n\n<div class=\"epyt-gallery\" data-currpage=\"1\" id=\"epyt_gallery_33552\"><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_47196\"  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_33552\"  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>why-run mode is a way to see what the chef-client would have configured, had an actual chef-client run occurred. This approach is similar to the concept of \u201cno-operation\u201d (or \u201cno-op\u201d): decide what should be done, but then don\u2019t actually do anything until it\u2019s done right. Run the executable in why-run mode, which is a type&#8230;<\/p>\n","protected":false},"author":1,"featured_media":5019,"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,321,4916],"class_list":["post-4934","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-chef","tag-chef","tag-chef-client","tag-mode","tag-why-run"],"_links":{"self":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/4934","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=4934"}],"version-history":[{"count":4,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/4934\/revisions"}],"predecessor-version":[{"id":25609,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/4934\/revisions\/25609"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media\/5019"}],"wp:attachment":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media?parent=4934"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/categories?post=4934"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/tags?post=4934"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}