Skip to content

Instantly share code, notes, and snippets.

@rcreasey
Created April 5, 2011 21:11
Show Gist options
  • Save rcreasey/904564 to your computer and use it in GitHub Desktop.
Save rcreasey/904564 to your computer and use it in GitHub Desktop.
#
# Cookbook Name:: cloud
# Recipe:: hostname
#
template "/etc/hosts" do
source "hostname/hosts.erb"
owner "root"
group "root"
mode 0644
backup false
end
execute "Reset Hostname" do
command "hostname --file /etc/hostname"
action :nothing
end
file "/etc/hostname" do
content node.name
notifies :run, resources(:execute => "Reset Hostname"), :immediately
end
127.0.0.1 localhost.localdomain localhost
<%= node.ipaddress %> <%= node.name %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment