<?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 Client Archives - scmGalaxy</title>
	<atom:link href="https://www.scmgalaxy.com/tutorials/tag/chef-client/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.scmgalaxy.com/tutorials/tag/chef-client/</link>
	<description>A Platform for Software Engineers</description>
	<lastBuildDate>Sat, 27 Feb 2021 10:12:52 +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>How to run chef-client in why-run mode aka “no-operation”</title>
		<link>https://www.scmgalaxy.com/tutorials/how-to-run-chef-client-in-why-run-mode-aka-no-operation/</link>
					<comments>https://www.scmgalaxy.com/tutorials/how-to-run-chef-client-in-why-run-mode-aka-no-operation/#respond</comments>
		
		<dc:creator><![CDATA[scmgalaxy K]]></dc:creator>
		<pubDate>Wed, 02 May 2018 09:36:20 +0000</pubDate>
				<category><![CDATA[Chef]]></category>
		<category><![CDATA[Chef Client]]></category>
		<category><![CDATA[mode]]></category>
		<category><![CDATA[why-run]]></category>
		<guid isPermaLink="false">http://www.scmgalaxy.com/tutorials/?p=4934</guid>

					<description><![CDATA[<p>why-run mode is a way to see what the chef-client would have configured, had an actual chef-client run occurred. This [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/how-to-run-chef-client-in-why-run-mode-aka-no-operation/">How to run chef-client in why-run mode aka “no-operation”</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><img fetchpriority="high" decoding="async" class="alignnone size-full wp-image-5017" src="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2018/05/chef-client.jpg" alt="" width="600" height="350" srcset="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2018/05/chef-client.jpg 600w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2018/05/chef-client-300x175.jpg 300w" sizes="(max-width: 600px) 100vw, 600px" /></p>
<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 “no-operation” (or “no-op”): decide what should be done, but then don’t actually do anything until it’s 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>
<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>
<ol>
<li>Getting the configuration data,</li>
<li>Authenticating to the Chef server,</li>
<li>Rebuilding the node object,</li>
<li>Expanding the run-list,</li>
<li>Getting the necessary cookbook files,</li>
<li>Resetting node attributes,</li>
<li>Identifying the resources, and</li>
<li>Building the resource collection and</li>
<li>Does not include mapping each resource to a provider or configuring any part of the system.</li>
</ol>
<p><strong>How to run chef-client?</strong></p>
<pre class="brush: plain; title: ; notranslate">$ sudo chef-client -o 'recipe&#x5B;ntp]' --why-run
$ sudo chef-client -o 'recipe&#x5B;ntp]' -W</pre>
<p><a href="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2018/05/chef-why-run-mode-chef-client.png"><img decoding="async" class="aligncenter size-full wp-image-4935" src="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2018/05/chef-why-run-mode-chef-client.png" alt="" width="1029" height="569" srcset="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2018/05/chef-why-run-mode-chef-client.png 1029w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2018/05/chef-why-run-mode-chef-client-300x166.png 300w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2018/05/chef-why-run-mode-chef-client-768x425.png 768w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2018/05/chef-why-run-mode-chef-client-1024x566.png 1024w" sizes="(max-width: 1029px) 100vw, 1029px" /></a></p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/how-to-run-chef-client-in-why-run-mode-aka-no-operation/">How to run chef-client in why-run mode aka “no-operation”</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/how-to-run-chef-client-in-why-run-mode-aka-no-operation/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Ecosystem of chef and Its associated tools explained</title>
		<link>https://www.scmgalaxy.com/tutorials/ecosystem-of-chef-and-its-associated-tools-explained/</link>
					<comments>https://www.scmgalaxy.com/tutorials/ecosystem-of-chef-and-its-associated-tools-explained/#respond</comments>
		
		<dc:creator><![CDATA[scmgalaxy K]]></dc:creator>
		<pubDate>Thu, 19 Apr 2018 13:32:03 +0000</pubDate>
				<category><![CDATA[Chef]]></category>
		<category><![CDATA[Chef Apply]]></category>
		<category><![CDATA[Chef Automate]]></category>
		<category><![CDATA[Chef Backend]]></category>
		<category><![CDATA[Chef Client]]></category>
		<category><![CDATA[Chef Compliance]]></category>
		<category><![CDATA[Chef Development Kit]]></category>
		<category><![CDATA[Chef Manage]]></category>
		<category><![CDATA[Chef server]]></category>
		<category><![CDATA[ChefSpec]]></category>
		<category><![CDATA[Foodcritic]]></category>
		<category><![CDATA[InSpec]]></category>
		<category><![CDATA[kitchen]]></category>
		<category><![CDATA[Knife]]></category>
		<category><![CDATA[Push Jobs Client]]></category>
		<category><![CDATA[Push Jobs Server]]></category>
		<category><![CDATA[RuboCop]]></category>
		<category><![CDATA[Serverspec]]></category>
		<category><![CDATA[Supermarket]]></category>
		<category><![CDATA[Test Kitchen]]></category>
		<category><![CDATA[Tools]]></category>
		<guid isPermaLink="false">http://www.scmgalaxy.com/tutorials/?p=4924</guid>

					<description><![CDATA[<p>Chef Apply chef-apply is an executable program that runs a single recipe from the command line. Is part of the [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/ecosystem-of-chef-and-its-associated-tools-explained/">Ecosystem of chef and Its associated tools explained</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><img decoding="async" class="alignnone size-full wp-image-5030" src="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2018/04/chef.png" alt="" width="600" height="350" srcset="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2018/04/chef.png 600w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2018/04/chef-300x175.png 300w" sizes="(max-width: 600px) 100vw, 600px" /></p>
<p><strong>Chef Apply</strong><br />
chef-apply is an executable program that runs a single recipe from the command line. Is part of the Chef development kit. A great way to explore resources</p>
<p><strong>Chef</strong><br />
The chef executable is a command-line tool which Generates applications, cookbooks, recipes, attributes, files, templates, and custom resources (LWRPs) and Ensures that RubyGems are downloaded properly for the chef-client development environment along with Verifies that all components are installed and configured correctly</p>
<p><strong>Knife</strong><br />
knife is a command-line tool that provides an interface between a local chef-repo and the Chef server. knife helps users to manage Nodes, Cookbooks and recipes, Roles, Environments, and Data Bags, Resources within various cloud environments, The installation of the chef-client onto nodes, Searching of indexed data on the Chef server</p>
<p><strong>Chef Client</strong><br />
The Chef client works with the Chef server to bring nodes to their desired states with policies you provide as recipes. The chef-client executable can be run as a daemon. A chef-client is an agent that runs locally on every node that is under management by Chef. 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>
<ul>
<li>Registering and authenticating the node with the Chef server</li>
<li>Building the node object</li>
<li>Synchronizing cookbooks</li>
<li>Compiling the resource collection by loading each of the required cookbooks, including recipes, attributes, and</li>
<li>all other dependencies</li>
<li>Taking the appropriate and required actions to configure the node</li>
<li>Looking for exceptions and notifications, handling each as required</li>
</ul>
<p><strong>Chef Development Kit</strong><br />
The Chef development kit contains all you need to develop and test your infrastructure, built by the awesome Chef community. Chef Development Kit has following Component installed&#8230;</p>
<ul>
<li>fauxhai</li>
<li>kitchen-vagrant</li>
<li>openssl</li>
<li>delivery-cli</li>
<li>test-kitchen</li>
<li>git</li>
<li>berkshelf</li>
<li>chefspec</li>
<li>knife-spork</li>
<li>inspec</li>
<li>tk-policyfile-provisioner</li>
<li>opscode-pushy-client</li>
<li>chef-dk</li>
<li>chef-sugar</li>
<li>chef-client</li>
<li>generated-cookbooks-pass-chefspec</li>
<li>chef-provisioning</li>
<li>package installation</li>
</ul>
<p><strong>Chef Server</strong><br />
The Chef server makes it easy to automate your infrastructure, manage scale and complexity, and safeguard your systems.</p>
<p>Chef Server has following tools which should be running&#8230;</p>
<ul>
<li>bookshelf</li>
<li>nginx</li>
<li>oc_bifrost</li>
<li>oc_id</li>
<li>opscode-erchef</li>
<li>opscode-expander</li>
<li>opscode-solr4</li>
<li>postgresql</li>
<li>rabbitmq</li>
<li>redis_lb</li>
</ul>
<p><strong>InSpec</strong><br />
InSpec is an open-source testing framework for infrastructure with a human- and machine-readable language for specifying compliance, security and policy requirements.</p>
<p><strong>Push Jobs Client</strong><br />
The Push Jobs client communicates with the Push Jobs server, which extends the Chef Server to allow you to execute commands across hundreds or even thousands of nodes in your Chef-managed infrastructure.</p>
<p><strong>Push Jobs Server</strong><br />
The Push Jobs server add-on, along with its associated client, extends the Chef Server to allow you to execute commands across hundreds or even thousands of nodes in your Chef-managed infrastructure.</p>
<p><strong>Supermarket</strong><br />
Supermarket is an artifact repository that makes it easy to browse, use, and share communal cookbooks and tools within your organization.</p>
<p><strong>Chef Automate</strong><br />
One platform with a unified workflow, end-to-end visibility, and automated compliance over your entire Chef ecosystem.</p>
<p><strong>Chef Compliance</strong><br />
Assess and monitor infrastructure compliance and use InSpec compliance profiles to validate that production servers are properly configured.</p>
<p><strong>Chef Backend</strong><br />
Chef High Availability makes it easy to build high-availability Chef clusters on any infrastructure.</p>
<p><strong>Chef Manage</strong><br />
Chef Manage is an Enterprise Chef add-on that enables a web-based user interface for visualizing and managing nodes, data bags, roles, environments, cookbooks and role-based access control (RBAC).</p>
<p><strong>Kitchen or Test Kitchen</strong><br />
kitchen is the command-line tool for Kitchen, an integration testing tool used by the chef-client. Kitchen runs tests against any combination of platforms using any combination of test suites. Each test, however, is done against a specific instance, which is comprised of a single platform and a single set of testing criteria.</p>
<p>“Test Kitchen is an integration tool for developing and testing infrastructure code and software on isolated target platforms.” It creates test machines, converges them, and runs post-convergence tests against them to verify their state. Test Kitchen is written in Ruby. It has a plugin system for supporting machine creation through a variety of virtual machine technologies such as vagrant, EC2, docker, and several others. Test Kitchen makes it easy for Chef developers to test cookbooks on a variety of platforms. It uses busser to install post-convergence integration test tools such as Serverspec or BATS that actually perform the tests.</p>
<p><strong>foodcritic</strong><br />
Foodcritic is a helpful lint tool you can use to check your Chef cookbooks for common problems.<br />
http://www.foodcritic.io/</p>
<p><strong>ChefSpec</strong><br />
ChefSpec is a framework that tests resources and recipes as part of a simulated chef-client run. ChefSpec tests execute very quickly. When used as part of the cookbook authoring workflow, ChefSpec tests are often the first indicator of problems that may exist within a cookbook.<br />
ChefSpec is packaged as part of the Chef development kit. To run ChefSpec<br />
$ chef exec rspec<br />
https://docs.chef.io/chefspec.html</p>
<p><strong>RuboCop</strong><br />
Rubocop is a Ruby command-line tool that performs lint and style checks based on the community driven Ruby Style Guide. It performs static analysis of any Ruby code, which includes Chef recipes, resources, library helpers, and so forth. Rubocop can be configured via .rubocop.yml to exclude certain rules, and it can be run with “–lint” to perform only lint checking, excluding all style checks. Rubocop is used in the Chef community in cookbooks to make contributions more consistent and easier to manage.</p>
<p><strong>Serverspec</strong><br />
Serverspec is an “outside-in” integration test framework. It is platform and tool agnostic, and is used by other configuration management systems to verify systems are configured as desired. It checks the actual state of the target node by executing commands locally, via SSH, via WinRM, or other remote transports. Serverspec is implemented in RSpec, and uses RSpec test syntax.</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/ecosystem-of-chef-and-its-associated-tools-explained/">Ecosystem of chef and Its associated tools explained</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/ecosystem-of-chef-and-its-associated-tools-explained/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Chef Internal &#8211; How Chef maintain the state of each resources internally?</title>
		<link>https://www.scmgalaxy.com/tutorials/chef-internal-how-chef-maintain-the-state-of-each-resources-internally/</link>
					<comments>https://www.scmgalaxy.com/tutorials/chef-internal-how-chef-maintain-the-state-of-each-resources-internally/#respond</comments>
		
		<dc:creator><![CDATA[scmgalaxy K]]></dc:creator>
		<pubDate>Wed, 26 Jul 2017 07:15:23 +0000</pubDate>
				<category><![CDATA[Chef]]></category>
		<category><![CDATA[Chef Client]]></category>
		<category><![CDATA[Chef Internal]]></category>
		<category><![CDATA[Chef Tutorials]]></category>
		<category><![CDATA[How]]></category>
		<category><![CDATA[Ohai]]></category>
		<category><![CDATA[Resources]]></category>
		<guid isPermaLink="false">http://www.scmgalaxy.com/tutorials/2017/07/26/chef-internal-how-chef-maintain-the-state-of-each-resources-internally/</guid>

					<description><![CDATA[<p>Chef Client A chef-client is an agent that runs locally on every node that is under management by Chef. The [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/chef-internal-how-chef-maintain-the-state-of-each-resources-internally/">Chef Internal &#8211; How Chef maintain the state of each resources internally?</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="size-full wp-image-2870 aligncenter" src="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2017/07/chef-internal.png" alt="chef-internal" width="600" height="400" srcset="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2017/07/chef-internal.png 600w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2017/07/chef-internal-300x200.png 300w" sizes="auto, (max-width: 600px) 100vw, 600px" /></p>
<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>
<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>
<ul class="simple" style="box-sizing: border-box; color: #3f5364; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px;">
<li style="box-sizing: border-box;">Registering and authenticating the node with the Chef server</li>
<li style="box-sizing: border-box;">Building the node object</li>
<li style="box-sizing: border-box;">Synchronizing cookbooks</li>
<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>
<li style="box-sizing: border-box;">Taking the appropriate and required actions to configure the node</li>
<li style="box-sizing: border-box;">Looking for exceptions and notifications, handling each as required</li>
</ul>
<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’t and it ensures that only nodes that are properly registered with the Chef server can be managed.</span></span></p>
<p><strong style="color: #3f5364; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px;">Ohai</strong></p>
<p>&nbsp;</p>
<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>
<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>
<ul class="simple" style="color: #3f5364; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; box-sizing: border-box;">
<li style="box-sizing: border-box;">Operating System</li>
<li style="box-sizing: border-box;">Network</li>
<li style="box-sizing: border-box;">Memory</li>
<li style="box-sizing: border-box;">Disk</li>
<li style="box-sizing: border-box;">CPU</li>
<li style="box-sizing: border-box;">Kernel</li>
<li style="box-sizing: border-box;">Host names</li>
<li style="box-sizing: border-box;">Fully qualified domain names</li>
<li style="box-sizing: border-box;">Virtualization</li>
<li style="box-sizing: border-box;">Cloud provider metadata</li>
</ul>
<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>
<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>
<p><span style="font-size: 14px;"><strong><span style="color: #3f5364; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;">Reference</span></strong></span><br />
<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>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/chef-internal-how-chef-maintain-the-state-of-each-resources-internally/">Chef Internal &#8211; How Chef maintain the state of each resources internally?</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/chef-internal-how-chef-maintain-the-state-of-each-resources-internally/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<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 loading="lazy" 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="auto, (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>
	</channel>
</rss>
