How to add multiple entries in the /etc/hosts file. I have used search (node: ':') which add all the entries to the host file. How to add only entries of one node?
Recipe:
hosts = search(:node, "role:xyz")
template "/etc/hosts" do
source "hosts.erb"
owner "root"
group "root"
mode 0644
variables(
:hosts => hosts,
:hostname => node[:hostname],
:fqdn => node[:fqdn]
)
end
Template :
127.0.0.1 <%= node['fqdn 1'] %>
127.0.0.1 <%= node['fqdn 2 '] %>
127.0.0.1 <%= node['fqdn 3'] %>
127.0.0.1 <%= node['fqdn 4'] %>
127.0.0.1 <%= node['fqdn 5'] %>
127.0.0.1 <%= node['fqdn 6'] %>
127.0.0.1 <%= node['fqdn 7'] %>
127.0.0.1 <%= node['fqdn 8'] %>
All i need is 7 entries by my search return all the node which i filter above.
Any suggesstions
Thanks,
Bali