[chef] Re: Re: Writing a cross-platform template definition


Chronological Thread 
  • From: Sean OMeara < >
  • To: " " < >
  • Subject: [chef] Re: Re: Writing a cross-platform template definition
  • Date: Fri, 14 Nov 2014 17:42:02 +0100

If it's something simple...

conditional logic in the recipe to manage what's compiled into the
resource collection is a popular technique.

if node['platform'] == 'windows'
   template 'mytemplate' do
     path 'c:\wat.bat'
     owner 'Administrator'
   end
else
   template 'mytemplate' do
     path '/wat.bat'
     owner 'root'
end
If you start getting more complicated, then something like this is an option

case node['platform_family']
when 'windows'
   include_recipe 'mycookbook::windows'
when 'rhel'
   include_recipe 'mycookbok::rhel'
end

-s



Archive powered by MHonArc 2.6.16.

§