{"id":4942,"date":"2018-05-03T06:31:23","date_gmt":"2018-05-03T06:31:23","guid":{"rendered":"http:\/\/www.scmgalaxy.com\/tutorials\/?p=4942"},"modified":"2021-11-17T10:35:25","modified_gmt":"2021-11-17T10:35:25","slug":"run_list-and-env_run_list-explanined-in-chef-role","status":"publish","type":"post","link":"https:\/\/www.devopsschool.com\/blog\/run_list-and-env_run_list-explanined-in-chef-role\/","title":{"rendered":"run_list and env_run_list explanined in chef role"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-5023\" src=\"http:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2018\/05\/chef.png\" alt=\"\" width=\"600\" height=\"350\" srcset=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2018\/05\/chef.png 600w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2018\/05\/chef-300x175.png 300w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/p>\n<p><strong>run-list<\/strong><br>\nA run-list defines all of the information necessary for Chef to configure a node into the desired state. A run-list may include roles and\/or recipes.<\/p>\n<p>A run-list must be in one of the following formats: fully qualified, cookbook, or default. Both roles and recipes must be in quotes, for example:<\/p>\n<p>[code]&#8217;role[NAME]&#8217;<br>\n&#8216;recipe[COOKBOOK::RECIPE]&#8217;<br>\n&#8216;recipe[COOKBOOK::RECIPE],COOKBOOK::RECIPE,role[NAME]'[\/code]<\/p>\n<p><strong>env_run_list<\/strong><br>\nWhen you specify the env_run_list in role and the chef-client will pick up the _default run-list if env_run_list[environment_name] is null or nonexistent. env_run_list is only for roles.The env run list is an override, so it totally replaces the default non-env run list if the env matches.<\/p>\n<p>[code]{<br>\n &#8220;name&#8221;: &#8220;webserver&#8221;,<br>\n &#8220;default_attributes&#8221;: {<br>\n },<br>\n &#8220;json_class&#8221;: &#8220;Chef::Role&#8221;,<br>\n &#8220;env_run_lists&#8221;: {<br>\n &#8220;production&#8221;: [],<br>\n &#8220;preprod&#8221;: [],<br>\n &#8220;test&#8221;: [ &#8220;role[base]&#8221;, &#8220;recipe[apache]&#8221; &#8220;recipe[apache::copy_test_configs]&#8221; ],<br>\n &#8220;dev&#8221;: [ &#8220;role[base]&#8221;, &#8220;recipe[apache]&#8221;, &#8220;recipe[apache::copy_dev_configs]&#8221; ]<br>\n },<br>\n &#8220;run_list&#8221;: [ &#8220;role[base]&#8221;, &#8220;recipe[apache]&#8221; ],<br>\n &#8220;description&#8221;: &#8220;The webserver role&#8221;,<br>\n &#8220;chef_type&#8221;: &#8220;role&#8221;,<br>\n &#8220;override_attributes&#8221;: {<br>\n }<br>\n}[\/code]<\/p>\n<p><strong>where:<\/strong><\/p>\n<ul>\n<li>\u201cwebserver\u201d is the name of the role<\/li>\n<li>\u201cenv_run_lists\u201d is a hash of per-environment run-lists for production, preprod, test, and dev<\/li>\n<li>\u201cproduction\u201d and \u201cpreprod\u201d use the default run-list because they do not have a per-environment run-list<\/li>\n<li>\u201crun_list\u201d defines the default run-list<\/li>\n<\/ul>\n<p><strong>Reference<\/strong><br>\nhttps:\/\/docs.chef.io\/run_lists.html<br>\nhttps:\/\/railsware.com\/blog\/2013\/09\/26\/getting-started-with-chef-server-part-2\/<\/p>\n\n<div class=\"epyt-gallery\" data-currpage=\"1\" id=\"epyt_gallery_42829\"><iframe loading=\"lazy\"  id=\"_ytid_99044\"  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_42829\"  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 class=\"epyt-gallery-list\"><div>Sorry, there was a YouTube error.<\/div><\/div><\/div>","protected":false},"excerpt":{"rendered":"<p>run-list A run-list defines all of the information necessary for Chef to configure a node into the desired state. A run-list may include roles and\/or recipes. A run-list must be&#8230; <\/p>\n","protected":false},"author":1,"featured_media":5023,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_joinchat":[],"footnotes":""},"categories":[88],"tags":[407,4917,852,4918],"class_list":["post-4942","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-chef","tag-chef","tag-env_run_list","tag-role","tag-run_list"],"_links":{"self":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/4942","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=4942"}],"version-history":[{"count":3,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/4942\/revisions"}],"predecessor-version":[{"id":25608,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/4942\/revisions\/25608"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media\/5023"}],"wp:attachment":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media?parent=4942"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/categories?post=4942"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/tags?post=4942"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}