Permalink
Browse files

Added hostname resource

  • Loading branch information...
1 parent 088be7e commit 7fac0f5cd472b01c99b4b97290e722b256b7da15 Ben Rockwood committed Sep 20, 2012
Showing with 9 additions and 12 deletions.
  1. +2 −0 cookbooks/smartos/attributes/default.rb
  2. +1 −2 cookbooks/smartos/metadata.rb
  3. +6 −10 cookbooks/smartos/recipes/default.rb
@@ -1,5 +1,7 @@
# SmartOS Base Recipes Attributes
+#default[:hostname] = ""
+
## NTP (Default to NTP Pool Servers)
default[:ntp][:servers] = ["0.pool.ntp.org", "1.pool.ntp.org", "2.pool.ntp.org"]
@@ -1,7 +1,6 @@
maintainer "Ben Rockwood"
maintainer_email "benr@joyent.com"
license "All rights reserved"
-description "Installs/Configures Compute Node"
+description "Configures SmartOS Global Zone"
long_description IO.read(File.join(File.dirname(__FILE__), 'README.rdoc'))
version "0.0.1"
-depends "joyent"
@@ -37,19 +37,15 @@
notifies :restart, resources(:service => "name-service-cache"), :immediate
end
-## Create loginlog and sulog
+## Set the Hostname
##
-file "/var/adm/loginlog" do
- owner "root"
- group "root"
- mode "0644"
+if node.attribute?("hostname")
+ execute "Set hostname" do
+ command "/usr/bin/hostname #{node[:hostname]} && /usr/bin/hostname > /etc/nodename"
+ only_if "grep unknown /etc/nodename"
+ end
end
-file "/var/adm/sulog" do
- owner "root"
- group "root"
- mode "0644"
-end
## Enable atime on /var, so that WTMPX and logs work properly
##

0 comments on commit 7fac0f5

Please sign in to comment.