{"id":431,"date":"2015-09-20T09:17:05","date_gmt":"2015-09-20T09:17:05","guid":{"rendered":"http:\/\/www.scmgalaxy.com\/tutorials\/2015\/09\/20\/chef-commands-line-reference\/"},"modified":"2021-02-27T09:50:37","modified_gmt":"2021-02-27T09:50:37","slug":"chef-commands-line-reference","status":"publish","type":"post","link":"https:\/\/www.scmgalaxy.com\/tutorials\/chef-commands-line-reference\/","title":{"rendered":"Chef Commands Line Reference | Chef Commands Line Guide | Cheatsheet"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3356 aligncenter\" src=\"https:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2015\/09\/chef-commands-line-referenc.png\" alt=\"chef-commands-line-reference\" width=\"600\" height=\"400\" srcset=\"https:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2015\/09\/chef-commands-line-referenc.png 600w, https:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2015\/09\/chef-commands-line-referenc-300x200.png 300w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/p>\n<p><strong>To run single recipe using chef-solo<\/strong><\/p>\n<pre><code>&gt; chef-solo -c \/opt\/chef\/repo\/config\/solo.rb -o my_cookbook::recipe<\/code><\/pre>\n<p><strong>To run the single reciepe in same machine<\/strong><\/p>\n<p>&gt; chef-apply hello.rb<\/p>\n<p><strong>To generate the cookbook standard structure<\/strong><\/p>\n<pre>&gt; chef generate cookbook learn_chef_httpd<\/pre>\n<pre>&gt; knife cookbook create smartmontools -r md<\/pre>\n<p><strong>To generate the template file in cookbook<\/strong><\/p>\n<pre>&gt; chef generate template learn_chef_httpd index.html<\/pre>\n<p><strong>To run the cookbook in local mode<\/strong><\/p>\n<pre>&gt; sudo chef-client --local-mode --runlist \u2018recipe[learn_chef_httpd]\u2019<\/pre>\n<pre><\/pre>\n<p><strong>To download the cookbooks from market place<\/strong><\/p>\n<pre>&gt; knife cookbook site download learn_chef_httpd<\/pre>\n<pre>&gt; knife cookbook site install learn_chef_httpd<\/pre>\n<pre><\/pre>\n<p><strong>To Upload the cookbooks to chef server<\/strong><\/p>\n<pre>&gt; knife cookbook upload learn_chef_httpd<\/pre>\n<pre>&gt; knife cookbook upload -a<\/pre>\n<p><strong>To bootstrap a nodes<\/strong><\/p>\n<pre>&gt; knife bootstrap {{address}} --ssh-user {{user}} --ssh-password '{{password}}' --sudo --use-sudo-password --node-name node1 --run-list 'recipe[learn_chef_apache2]'<\/pre>\n<pre>&gt; knife bootstrap uvo1t75faaktzc532w6.vm.cld.sr -x root -P Br356YS0iy \u2013sudo \u2013node-name firefox<\/pre>\n<pre>&gt; knife bootstrap 123.45.6.789 -x username -P password \u2013sudo<\/pre>\n<pre><\/pre>\n<p><strong>To see the list of nodes<\/strong><\/p>\n<pre>&gt;knife node list<\/pre>\n<p><strong>To edit the node run list<\/strong><\/p>\n<pre>&gt; knife node edit name_of_node<\/pre>\n<p><strong>To see the info about each nodes<\/strong><\/p>\n<pre>&gt; knife node show node1<\/pre>\n<p><strong>Run the cooksbooks on nodes<\/strong><\/p>\n<pre>&gt; knife ssh {{address}} 'sudo chef-client' --manual-list --ssh-user {{user}} --ssh-password '{{password}}'<\/pre>\n<pre>&gt; ssh username@ipadddress -i mycredentials.pem sudo chef-client<\/pre>\n<p><strong>To add the run list to the nodes.<\/strong><\/p>\n<pre>knife node run_list add C2445575914.domain 'recipe[hptrain]'<\/pre>\n<pre>knife node run_list set test-node '''recipe[iptables]''' [Windows - Powershell]<\/pre>\n<pre>knife node run_list set test-node 'recipe[iptables]' [Windows - Command]<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>To run single recipe using chef-solo &gt; chef-solo -c \/opt\/chef\/repo\/config\/solo.rb -o my_cookbook::recipe To run the single reciepe in same machine [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":3356,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_joinchat":[],"footnotes":""},"categories":[88],"tags":[1385,407,1493,1495,1488,1491,1492,1489,1490,1494,1496,333,824],"class_list":["post-431","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-chef","tag-cheatsheet","tag-chef","tag-chef-commands","tag-chef-commands-guide","tag-chef-commands-line","tag-chef-commands-line-guide","tag-chef-commands-line-help","tag-chef-commands-line-reference","tag-chef-commands-line-tutorial","tag-chef-commands-reference","tag-chef-commands-tutorials","tag-command","tag-command-line"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Chef Commands Line Reference | Chef Commands Line Guide | Cheatsheet - scmGalaxy<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.scmgalaxy.com\/tutorials\/chef-commands-line-reference\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Chef Commands Line Reference | Chef Commands Line Guide | Cheatsheet - scmGalaxy\" \/>\n<meta property=\"og:description\" content=\"To run single recipe using chef-solo &gt; chef-solo -c \/opt\/chef\/repo\/config\/solo.rb -o my_cookbook::recipe To run the single reciepe in same machine [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.scmgalaxy.com\/tutorials\/chef-commands-line-reference\/\" \/>\n<meta property=\"og:site_name\" content=\"scmGalaxy\" \/>\n<meta property=\"article:published_time\" content=\"2015-09-20T09:17:05+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-02-27T09:50:37+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2015\/09\/chef-commands-line-referenc.png\" \/>\n\t<meta property=\"og:image:width\" content=\"600\" \/>\n\t<meta property=\"og:image:height\" content=\"400\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"scmgalaxy K\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"scmgalaxy K\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/chef-commands-line-reference\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/chef-commands-line-reference\\\/\"},\"author\":{\"name\":\"scmgalaxy K\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#\\\/schema\\\/person\\\/fc12ad190f540e79460243c81148d102\"},\"headline\":\"Chef Commands Line Reference | Chef Commands Line Guide | Cheatsheet\",\"datePublished\":\"2015-09-20T09:17:05+00:00\",\"dateModified\":\"2021-02-27T09:50:37+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/chef-commands-line-reference\\\/\"},\"wordCount\":97,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/chef-commands-line-reference\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/wp-content\\\/uploads\\\/2015\\\/09\\\/chef-commands-line-referenc.png\",\"keywords\":[\"CheatSheet\",\"Chef\",\"Chef commands\",\"Chef commands Guide\",\"Chef commands line\",\"Chef commands line Guide\",\"Chef commands line help\",\"Chef commands line reference\",\"Chef commands line Tutorial\",\"Chef commands reference\",\"Chef commands Tutorials\",\"command\",\"Command line\"],\"articleSection\":[\"Chef\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/chef-commands-line-reference\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/chef-commands-line-reference\\\/\",\"url\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/chef-commands-line-reference\\\/\",\"name\":\"Chef Commands Line Reference | Chef Commands Line Guide | Cheatsheet - scmGalaxy\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/chef-commands-line-reference\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/chef-commands-line-reference\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/wp-content\\\/uploads\\\/2015\\\/09\\\/chef-commands-line-referenc.png\",\"datePublished\":\"2015-09-20T09:17:05+00:00\",\"dateModified\":\"2021-02-27T09:50:37+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#\\\/schema\\\/person\\\/fc12ad190f540e79460243c81148d102\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/chef-commands-line-reference\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/chef-commands-line-reference\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/chef-commands-line-reference\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/wp-content\\\/uploads\\\/2015\\\/09\\\/chef-commands-line-referenc.png\",\"contentUrl\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/wp-content\\\/uploads\\\/2015\\\/09\\\/chef-commands-line-referenc.png\",\"width\":600,\"height\":400,\"caption\":\"chef-commands-line-reference\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/chef-commands-line-reference\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Chef Commands Line Reference | Chef Commands Line Guide | Cheatsheet\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#website\",\"url\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/\",\"name\":\"scmGalaxy\",\"description\":\"A Platform for Software Engineers\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#\\\/schema\\\/person\\\/fc12ad190f540e79460243c81148d102\",\"name\":\"scmgalaxy K\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4b902ea8c77ee0a326c112f29d0edf51b7c3e1cd05c4fb92a810177e9c3f12a9?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4b902ea8c77ee0a326c112f29d0edf51b7c3e1cd05c4fb92a810177e9c3f12a9?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4b902ea8c77ee0a326c112f29d0edf51b7c3e1cd05c4fb92a810177e9c3f12a9?s=96&d=mm&r=g\",\"caption\":\"scmgalaxy K\"},\"sameAs\":[\"http:\\\/\\\/www.DevOpsSchool.com\"],\"url\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/author\\\/scmgalaxy\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Chef Commands Line Reference | Chef Commands Line Guide | Cheatsheet - scmGalaxy","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.scmgalaxy.com\/tutorials\/chef-commands-line-reference\/","og_locale":"en_US","og_type":"article","og_title":"Chef Commands Line Reference | Chef Commands Line Guide | Cheatsheet - scmGalaxy","og_description":"To run single recipe using chef-solo &gt; chef-solo -c \/opt\/chef\/repo\/config\/solo.rb -o my_cookbook::recipe To run the single reciepe in same machine [&hellip;]","og_url":"https:\/\/www.scmgalaxy.com\/tutorials\/chef-commands-line-reference\/","og_site_name":"scmGalaxy","article_published_time":"2015-09-20T09:17:05+00:00","article_modified_time":"2021-02-27T09:50:37+00:00","og_image":[{"width":600,"height":400,"url":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2015\/09\/chef-commands-line-referenc.png","type":"image\/png"}],"author":"scmgalaxy K","twitter_card":"summary_large_image","twitter_misc":{"Written by":"scmgalaxy K","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/chef-commands-line-reference\/#article","isPartOf":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/chef-commands-line-reference\/"},"author":{"name":"scmgalaxy K","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#\/schema\/person\/fc12ad190f540e79460243c81148d102"},"headline":"Chef Commands Line Reference | Chef Commands Line Guide | Cheatsheet","datePublished":"2015-09-20T09:17:05+00:00","dateModified":"2021-02-27T09:50:37+00:00","mainEntityOfPage":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/chef-commands-line-reference\/"},"wordCount":97,"commentCount":0,"image":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/chef-commands-line-reference\/#primaryimage"},"thumbnailUrl":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2015\/09\/chef-commands-line-referenc.png","keywords":["CheatSheet","Chef","Chef commands","Chef commands Guide","Chef commands line","Chef commands line Guide","Chef commands line help","Chef commands line reference","Chef commands line Tutorial","Chef commands reference","Chef commands Tutorials","command","Command line"],"articleSection":["Chef"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.scmgalaxy.com\/tutorials\/chef-commands-line-reference\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/chef-commands-line-reference\/","url":"https:\/\/www.scmgalaxy.com\/tutorials\/chef-commands-line-reference\/","name":"Chef Commands Line Reference | Chef Commands Line Guide | Cheatsheet - scmGalaxy","isPartOf":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/chef-commands-line-reference\/#primaryimage"},"image":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/chef-commands-line-reference\/#primaryimage"},"thumbnailUrl":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2015\/09\/chef-commands-line-referenc.png","datePublished":"2015-09-20T09:17:05+00:00","dateModified":"2021-02-27T09:50:37+00:00","author":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#\/schema\/person\/fc12ad190f540e79460243c81148d102"},"breadcrumb":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/chef-commands-line-reference\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.scmgalaxy.com\/tutorials\/chef-commands-line-reference\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/chef-commands-line-reference\/#primaryimage","url":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2015\/09\/chef-commands-line-referenc.png","contentUrl":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2015\/09\/chef-commands-line-referenc.png","width":600,"height":400,"caption":"chef-commands-line-reference"},{"@type":"BreadcrumbList","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/chef-commands-line-reference\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.scmgalaxy.com\/tutorials\/"},{"@type":"ListItem","position":2,"name":"Chef Commands Line Reference | Chef Commands Line Guide | Cheatsheet"}]},{"@type":"WebSite","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#website","url":"https:\/\/www.scmgalaxy.com\/tutorials\/","name":"scmGalaxy","description":"A Platform for Software Engineers","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.scmgalaxy.com\/tutorials\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#\/schema\/person\/fc12ad190f540e79460243c81148d102","name":"scmgalaxy K","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/4b902ea8c77ee0a326c112f29d0edf51b7c3e1cd05c4fb92a810177e9c3f12a9?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/4b902ea8c77ee0a326c112f29d0edf51b7c3e1cd05c4fb92a810177e9c3f12a9?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4b902ea8c77ee0a326c112f29d0edf51b7c3e1cd05c4fb92a810177e9c3f12a9?s=96&d=mm&r=g","caption":"scmgalaxy K"},"sameAs":["http:\/\/www.DevOpsSchool.com"],"url":"https:\/\/www.scmgalaxy.com\/tutorials\/author\/scmgalaxy\/"}]}},"_links":{"self":[{"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/posts\/431","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/comments?post=431"}],"version-history":[{"count":2,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/posts\/431\/revisions"}],"predecessor-version":[{"id":3357,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/posts\/431\/revisions\/3357"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/media\/3356"}],"wp:attachment":[{"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/media?parent=431"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/categories?post=431"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/tags?post=431"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}