Skip to content

Instantly share code, notes, and snippets.

@gswallow
Created October 23, 2013 15:36
Show Gist options
  • Save gswallow/7121025 to your computer and use it in GitHub Desktop.
Save gswallow/7121025 to your computer and use it in GitHub Desktop.
unless Chef::Config[:solo]
case node.platform_family
when "windows"
file = "#{node['kernel']['os_info']['system_directory']}\\drivers\\etc\\hosts"
else
file = "/etc/hosts"
end
members = search(:node, "chef_environment:#{node.chef_environment}").to_a
template file do
mode "0644"
owner "root"
group "root"
variables(
:hosts => members
)
action :create
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment