The docs regarding template specificity indicate the OS is the only
criteria that can be used for dynamically choosing a template:
The pattern for file specificity is as follows:
- host-node[:fqdn]
- node[:platform]-node[:platform_version]
- node[:platform]-version_components: The version string is split on
decimals and searched from greatest specificity to least; for example, if
the location from the last rule was centos-5.7.1, then centos-5.7 and
centos-5 would also be searched.
- node[:platform]
- default
Can I use other criteria? I would like to choose a template based on metal
vs VM.
Thanks a lot,
Guy
If that's an attribute you have available you can base it on that:
template "/etc/some/template" do
source "#{node['server_type']}/template.erb"
< other stuff >
end
Then store the templates in the cookbook templates folder under:
./templates/default/metal/
./templates/default/vm/
On Tue, Dec 3, 2013 at 10:16 AM, Guy Matz guymatz@gmail.com wrote:
The docs regarding template specificity indicate the OS is the only
criteria that can be used for dynamically choosing a template:
The pattern for file specificity is as follows:
- host-node[:fqdn]
- node[:platform]-node[:platform_version]
- node[:platform]-version_components: The version string is split on
decimals and searched from greatest specificity to least; for example, if
the location from the last rule was centos-5.7.1, then centos-5.7 and
centos-5 would also be searched.
- node[:platform]
- default
Can I use other criteria? I would like to choose a template based on
metal vs VM.
Thanks a lot,
Guy