Templates - Location Specificity - Not working


#1

Hey All,

I’ve just had the need to choose a template based on node[:fqdn]

According to http://docs.opscode.com/essentials_cookbook_templates_location_specificity.html it should work.

However during the chef-client run it does not seem to look for host- directories.

OS is oracle linux 5.x
Chef-client is version 10.26.0

Here is a sample of the error

Chef::Exceptions::FileNotFound

Cookbook ‘mycookbook’ (0.1.0) does not contain a file at any of these locations:
templates/oracle-5.5/hosts.erb
templates/oracle/hosts.erb
templates/default/hosts.erb

It should be looking for:
templates/host-myhost.domain.com/hosts.erb

Anyone have any thoughts

Wade Peacock
Production IT - Automation/System Engineer | Vision Critical
direct +1.604.629.9358 mobile +1.604.363.8137
web visioncritical.comhttp://www.visioncritical.com/ | @VisionCritical on Twitterhttps://twitter.com/visioncritical | Visit Vision Critical on LinkedInhttp://www.linkedin.com/company/vision-critical

New York | London | Hong Kong | Vancouver | Paris | San Francisco | Sydney | Tokyo | Toronto | Cologne | Minneapolis | Chicago | Ottawa | Detroit
Click here to watch our clients share their Vision Critical successes: www.visioncritical.com/client-storieshttp://www.visioncritical.com/client-stories


#2

Doh. Got it working. Had a comma not a period on directory name. My Bad.

From: Wade Peacock [mailto:Wade.Peacock@visioncritical.com]
Sent: Tuesday, June 25, 2013 12:35 PM
To: 'chef@lists.opscode.com’
Subject: [chef] Templates - Location Specificity - Not working

Hey All,

I’ve just had the need to choose a template based on node[:fqdn]

According to http://docs.opscode.com/essentials_cookbook_templates_location_specificity.html it should work.

However during the chef-client run it does not seem to look for host- directories.

OS is oracle linux 5.x
Chef-client is version 10.26.0

Here is a sample of the error

Chef::Exceptions::FileNotFound

Cookbook ‘mycookbook’ (0.1.0) does not contain a file at any of these locations:
templates/oracle-5.5/hosts.erb
templates/oracle/hosts.erb
templates/default/hosts.erb

It should be looking for:
templates/host-myhost.domain.com/hosts.erb

Anyone have any thoughts

Wade Peacock
Production IT - Automation/System Engineer | Vision Critical
direct +1.604.629.9358 mobile +1.604.363.8137
web visioncritical.comhttp://www.visioncritical.com/ | @VisionCritical on Twitterhttps://twitter.com/visioncritical | Visit Vision Critical on LinkedInhttp://www.linkedin.com/company/vision-critical

New York | London | Hong Kong | Vancouver | Paris | San Francisco | Sydney | Tokyo | Toronto | Cologne | Minneapolis | Chicago | Ottawa | Detroit

Click here to watch our clients share their Vision Critical successes: www.visioncritical.com/client-storieshttp://www.visioncritical.com/client-stories