<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Chef cookbook Archives - scmGalaxy</title>
	<atom:link href="https://www.scmgalaxy.com/tutorials/tag/chef-cookbook/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.scmgalaxy.com/tutorials/tag/chef-cookbook/</link>
	<description>A Platform for Software Engineers</description>
	<lastBuildDate>Tue, 13 Jul 2021 14:46:06 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1</generator>
	<item>
		<title>What is the significance of the default directory under chef cookbook /templates?</title>
		<link>https://www.scmgalaxy.com/tutorials/what-is-the-significance-of-the-default-directory-under-chef-cookbook-templates/</link>
					<comments>https://www.scmgalaxy.com/tutorials/what-is-the-significance-of-the-default-directory-under-chef-cookbook-templates/#respond</comments>
		
		<dc:creator><![CDATA[scmgalaxy K]]></dc:creator>
		<pubDate>Wed, 26 Jul 2017 06:39:53 +0000</pubDate>
				<category><![CDATA[Chef]]></category>
		<category><![CDATA[Chef Client]]></category>
		<category><![CDATA[Chef cookbook]]></category>
		<category><![CDATA[Chef Guide]]></category>
		<category><![CDATA[Chef templates]]></category>
		<category><![CDATA[Chef Tutorials]]></category>
		<category><![CDATA[Default directory]]></category>
		<guid isPermaLink="false">http://www.scmgalaxy.com/tutorials/2017/07/26/what-is-the-significance-of-the-default-directory-under-chef-cookbook-templates/</guid>

					<description><![CDATA[<p>&#160; What is the significance of the default directory under chef cookbook /templates? A cookbook is frequently designed to work [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/what-is-the-significance-of-the-default-directory-under-chef-cookbook-templates/">What is the significance of the default directory under chef cookbook /templates?</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[<div><img fetchpriority="high" decoding="async" class="size-full wp-image-2878 aligncenter" src="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2017/07/chef-cookbook-templates.png" alt="" width="600" height="400" srcset="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2017/07/chef-cookbook-templates.png 600w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2017/07/chef-cookbook-templates-300x200.png 300w" sizes="(max-width: 600px) 100vw, 600px" /></div>
<p>&nbsp;</p>
<div>What is the significance of the default directory under chef cookbook /templates?</div>
<div></div>
<div>A cookbook is frequently designed to work across many platforms and is often required to distribute a specific template to a specific platform. This is a New in Chef Client 12.0. A cookbook can be designed to support the distribution of templates across platforms, while ensuring that the correct template ends up on each system.</div>
<div></div>
<p>&nbsp;</p>
<div><strong>The pattern for template specificity depends on two things: the lookup path and the source. The first pattern that matches is used:</strong></div>
<div></div>
<div>/host-$fqdn/$source</div>
<div>/$platform-$platform_version/$source</div>
<div>/$platform/$source</div>
<div>/default/$source</div>
<div>/$source</div>
<div></div>
<p>&nbsp;</p>
<div><strong>Use an array with the source property to define an explicit lookup path. For example:</strong></div>
<div>template &#8216;/test&#8217; do</div>
<div>  source [&#8220;#{node.chef_environment}.erb&#8221;, &#8216;default.erb&#8217;]</div>
<div>end</div>
<div></div>
<p>&nbsp;</p>
<div><strong>The following example emulates the entire file specificity pattern by defining it as an explicit path:</strong></div>
<div>template &#8216;/test&#8217; do</div>
<div>  source %W{</div>
<div>    host-#{node[&#8216;fqdn&#8217;]}/test.erb</div>
<div>    #{node[&#8216;platform&#8217;]}-#{node[&#8216;platform_version&#8217;]}/test.erb</div>
<div>    #{node[&#8216;platform&#8217;]}/test.erb</div>
<div>    default/test.erb</div>
<div>  }</div>
<div>end</div>
<div></div>
<p>&nbsp;</p>
<div><strong>A cookbook may have a /templates directory structure like this:</strong></div>
<div>/templates/</div>
<div>  windows-6.2</div>
<div>  windows-6.1</div>
<div>  windows-6.0</div>
<div>  windows</div>
<div>  default</div>
<div></div>
<p>&nbsp;</p>
<div><strong>and a resource that looks something like the following:</strong></div>
<div>template &#8216;C:\path\to\file\text_file.txt&#8217; do</div>
<div>  source &#8216;text_file.txt&#8217;</div>
<div>  mode &#8216;0755&#8217;</div>
<div>  owner &#8216;root&#8217;</div>
<div>  group &#8216;root&#8217;</div>
<div>end</div>
<div></div>
<p>&nbsp;</p>
<div><strong>This resource would be matched in the same order as the /templates directory structure. For a node named host-node-desktop that is running Windows 7, the second item would be the matching item and the location:</strong></div>
<div>/templates</div>
<div>  windows-6.2/text_file.txt</div>
<div>  windows-6.1/text_file.txt</div>
<div>  windows-6.0/text_file.txt</div>
<div>  windows/text_file.txt</div>
<div>
<p>  default/text_file.txt</p>
<p><strong>Reference</strong><br />
<a href="https://docs.chef.io/resource_template.html" target="_blank" rel="noopener">https://docs.chef.io/resource_template.html</a></p>
</div>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/what-is-the-significance-of-the-default-directory-under-chef-cookbook-templates/">What is the significance of the default directory under chef cookbook /templates?</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/what-is-the-significance-of-the-default-directory-under-chef-cookbook-templates/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Write 10 Chef Cookbooks to test your chef programming skills</title>
		<link>https://www.scmgalaxy.com/tutorials/write-10-chef-cookbooks-to-test-your-chef-programming-skills/</link>
					<comments>https://www.scmgalaxy.com/tutorials/write-10-chef-cookbooks-to-test-your-chef-programming-skills/#comments</comments>
		
		<dc:creator><![CDATA[scmgalaxy K]]></dc:creator>
		<pubDate>Mon, 27 Feb 2017 18:48:58 +0000</pubDate>
				<category><![CDATA[Chef]]></category>
		<category><![CDATA[Chef cookbook]]></category>
		<category><![CDATA[Chef programming]]></category>
		<category><![CDATA[Chef programming skills]]></category>
		<category><![CDATA[Chef programming test]]></category>
		<category><![CDATA[Chef recipe]]></category>
		<category><![CDATA[Cookbooks]]></category>
		<category><![CDATA[Skills]]></category>
		<category><![CDATA[Test]]></category>
		<category><![CDATA[Write]]></category>
		<category><![CDATA[Write chef cookbooks]]></category>
		<guid isPermaLink="false">http://www.scmgalaxy.com/tutorials/2017/02/27/write-10-chef-cookbooks-to-test-your-chef-programming-skills/</guid>

					<description><![CDATA[<p>Write a cookbook using you can install apache http server in CentOs and Ubuntu, enable the services and start the [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/write-10-chef-cookbooks-to-test-your-chef-programming-skills/">Write 10 Chef Cookbooks to test your chef programming skills</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h3><img decoding="async" class="aligncenter wp-image-3004 size-full" src="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2017/02/10-chef-cookbooks-to-test-y.png" alt="chef-cookbooks-to-test-your-chef-programming-skills" width="600" height="400" srcset="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2017/02/10-chef-cookbooks-to-test-y.png 600w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2017/02/10-chef-cookbooks-to-test-y-300x200.png 300w" sizes="(max-width: 600px) 100vw, 600px" /></h3>
<ol>
<li>
<h3>Write a cookbook using you can install apache http server in CentOs and Ubuntu, enable the services and start the service.</h3>
</li>
<li>
<h3>Write a recipe using template resources to create a file, but only if an attribute has a specific value.</h3>
</li>
<li>
<h3>Write a recipe to create a file using a string, but not if “/etc/passwd” exists?</h3>
</li>
<li>
<h3>Write a cookbook to unzip a file, and then move a files from one location to another using batch, bash chef resources?</h3>
</li>
<li>
<h3>Create a role and assign any two cookbooks to role and setup a 2 nodes assigned to role and conerse the role.</h3>
</li>
<li>
<h3>Write a cookbook using install version of latest tomcat and deploy jenkins.war files into war.</h3>
</li>
<li>
<h3>Write a 4 cookbooks php, mysql, apache and webapp respectively and map a dependency between them and install a sample web application.</h3>
</li>
<li>
<h3>Write a cookbook to install git, wget, zip in RHEL and Ubuntu.</h3>
</li>
<li>
<h3>Write a cookbook in which create a file using a string, but only if “/etc/passwd” exists</h3>
</li>
<li>
<h3>Write a coobook to run a batch file that unzips and then moves files from one location to another.</h3>
</li>
</ol>
<h3></h3>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/write-10-chef-cookbooks-to-test-your-chef-programming-skills/">Write 10 Chef Cookbooks to test your chef programming skills</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/write-10-chef-cookbooks-to-test-your-chef-programming-skills/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>Write 10 Chef Cookbooks to test your chef programming skills</title>
		<link>https://www.scmgalaxy.com/tutorials/write-10-chef-cookbooks-to-test-your-chef-programming-skills-2/</link>
					<comments>https://www.scmgalaxy.com/tutorials/write-10-chef-cookbooks-to-test-your-chef-programming-skills-2/#comments</comments>
		
		<dc:creator><![CDATA[scmgalaxy K]]></dc:creator>
		<pubDate>Mon, 27 Feb 2017 18:48:58 +0000</pubDate>
				<category><![CDATA[Chef]]></category>
		<category><![CDATA[Chef cookbook]]></category>
		<category><![CDATA[Chef programming]]></category>
		<category><![CDATA[Chef programming skills]]></category>
		<category><![CDATA[Chef programming test]]></category>
		<category><![CDATA[Chef recipe]]></category>
		<category><![CDATA[Cookbooks]]></category>
		<category><![CDATA[Skills]]></category>
		<category><![CDATA[Test]]></category>
		<category><![CDATA[Write]]></category>
		<category><![CDATA[Write chef cookbooks]]></category>
		<guid isPermaLink="false">http://www.scmgalaxy.com/tutorials/2017/02/27/write-10-chef-cookbooks-to-test-your-chef-programming-skills-2/</guid>

					<description><![CDATA[<p>Write a cookbook using you can install apache http server in CentOs and Ubuntu, enable the services and start the [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/write-10-chef-cookbooks-to-test-your-chef-programming-skills-2/">Write 10 Chef Cookbooks to test your chef programming skills</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><img decoding="async" class="aligncenter wp-image-3024 size-full" src="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2017/02/write-10-chef-cookbooks-to-.png" alt="chef-cookbooks" width="600" height="400" srcset="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2017/02/write-10-chef-cookbooks-to-.png 600w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2017/02/write-10-chef-cookbooks-to--300x200.png 300w" sizes="(max-width: 600px) 100vw, 600px" /></p>
<ol>
<li>Write a cookbook using you can install apache http server in CentOs and Ubuntu, enable the services and start the service.</li>
<li>Write a recipe using template resources to create a file, but only if an attribute has a specific value.
<ol>
<li>Write a recipe to create a file using a string, but not if “/etc/passwd” exists?</li>
</ol>
</li>
<li>Write a cookbook to unzip a file, and then move a files from one location to another using batch, bash chef resources?</li>
<li>Create a role and assign any two cookbooks to role and setup a 2 nodes assigned to role and conerse the role.</li>
<li>Write a cookbook using install version of latest tomcat and deploy jenkins.war files into war.</li>
<li>Write a 4 cookbooks php, mysql, apache and webapp respectively and map a dependency between them and install a sample web application.</li>
<li>Write a cookbook to install git, wget, zip in RHEL and Ubuntu.</li>
<li>Write a cookbook in which create a file using a string, but only if “/etc/passwd” exists</li>
<li>Write a coobook to run a batch file that unzips and then moves files from one location to another.</li>
</ol>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/write-10-chef-cookbooks-to-test-your-chef-programming-skills-2/">Write 10 Chef Cookbooks to test your chef programming skills</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/write-10-chef-cookbooks-to-test-your-chef-programming-skills-2/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>Chef &#8211; Documenting Cookbooks automatically</title>
		<link>https://www.scmgalaxy.com/tutorials/chef-documenting-cookbooks-automatically/</link>
					<comments>https://www.scmgalaxy.com/tutorials/chef-documenting-cookbooks-automatically/#respond</comments>
		
		<dc:creator><![CDATA[scmgalaxy K]]></dc:creator>
		<pubDate>Tue, 18 Aug 2015 16:20:57 +0000</pubDate>
				<category><![CDATA[Chef]]></category>
		<category><![CDATA[Auto]]></category>
		<category><![CDATA[Automate]]></category>
		<category><![CDATA[Automatically]]></category>
		<category><![CDATA[Automation]]></category>
		<category><![CDATA[Best Practices]]></category>
		<category><![CDATA[Chef cookbook]]></category>
		<category><![CDATA[Chef cookbook documentation]]></category>
		<category><![CDATA[Chef Guide]]></category>
		<category><![CDATA[Chef Tutorial]]></category>
		<category><![CDATA[Cookbooks]]></category>
		<category><![CDATA[Documentation]]></category>
		<category><![CDATA[Documenting Cookbooks]]></category>
		<guid isPermaLink="false">http://www.scmgalaxy.com/tutorials/2015/08/18/chef-documenting-cookbooks-automatically/</guid>

					<description><![CDATA[<p>Problems Area &#8211; Our infrastructure has many cookbooks that aim to be reusable, primarily through encapsulating behaviour in LWRPs. This [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/chef-documenting-cookbooks-automatically/">Chef &#8211; Documenting Cookbooks automatically</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><img loading="lazy" decoding="async" class="alignnone size-full wp-image-3444 aligncenter" src="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2015/08/chef-documenting-cookbooks.png" alt="chef-documenting-cookbooks" width="600" height="400" srcset="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2015/08/chef-documenting-cookbooks.png 600w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2015/08/chef-documenting-cookbooks-300x200.png 300w" sizes="auto, (max-width: 600px) 100vw, 600px" /></p>
<p><strong>Problems Area &#8211;</strong></p>
<p>Our infrastructure has many cookbooks that aim to be reusable, primarily through encapsulating behaviour in LWRPs. This led to an explosion of LWRPs and sometimes the documentation didn&#8217;t keep up or did just not exist.</p>
<p><strong>Solution 1: Follow Best Practices </strong></p>
<p>This command will create a README.rdoc by default, and I prefer <a href="https://www.collectiveray.com/markdown-cheat-sheet">Markdown</a>, so I specify the -r md option.</p>
<pre>&gt; knife cookbook create smartmontools -r md</pre>
<p><strong>Solution 2: Automate using plugins</strong></p>
<p>README.md which should be generated automatcially must contain information about the recipes, attributes, platform compatibility and cookbook requirements (i.e. depends, recommends, suggests etc).</p>
<p>Mathias Lafeldt wrote a knife plugin that generates an initial README.md from the metadata.rb file in a a cookbook.</p>
<p>Link &#8211;</p>
<ul>
<li><a href="https://github.com/mlafeldt/knife-cookbook-readme">https://github.com/mlafeldt/knife-cookbook-readme</a></li>
<li><a href="http://mlafeldt.github.io/knife-cookbook-readme/">http://mlafeldt.github.io/knife-cookbook-readme/</a></li>
</ul>
<p>Extension of Mathias Lafeldt was done here with regenerate README.md from the cookbook source code</p>
<ul>
<li><a href="https://github.com/realityforge/knife-cookbook-doc">https://github.com/realityforge/knife-cookbook-doc</a></li>
</ul>
<p><strong>Please refer these useful blogs as well which is referenced in order to write this article&#8230;</strong></p>
<ul>
<li><a href="http://realityforge.org/code/2013/04/01/documenting-cookbooks.html">http://realityforge.org/code/2013/04/01/documenting-cookbooks.html</a></li>
</ul>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/chef-documenting-cookbooks-automatically/">Chef &#8211; Documenting Cookbooks automatically</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/chef-documenting-cookbooks-automatically/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
