Permalink
Browse files

hosts cookbook added

  • Loading branch information...
1 parent 99f459f commit 7c932e69d0462665e5611e428007531f122c8f7f @mdxp committed Sep 3, 2010
Showing with 85 additions and 0 deletions.
  1. +8 −0 hosts/README.rdoc
  2. +29 −0 hosts/metadata.json
  3. +7 −0 hosts/metadata.rb
  4. +26 −0 hosts/recipes/default.rb
  5. +15 −0 hosts/templates/default/hosts.erb
View
8 hosts/README.rdoc
@@ -0,0 +1,8 @@
+= DESCRIPTION:
+
+= REQUIREMENTS:
+
+= ATTRIBUTES:
+
+= USAGE:
+
View
29 hosts/metadata.json
@@ -0,0 +1,29 @@
+{
+ "recipes": {
+ },
+ "replacing": {
+ },
+ "attributes": {
+ },
+ "maintainer_email": "marius@promethost.com",
+ "groupings": {
+ },
+ "dependencies": {
+ },
+ "recommendations": {
+ },
+ "long_description": "= DESCRIPTION:\n\n= REQUIREMENTS:\n\n= ATTRIBUTES: \n\n= USAGE:\n\n",
+ "suggestions": {
+ },
+ "platforms": {
+ },
+ "license": "Apache 2.0",
+ "version": "0.1.0",
+ "conflicting": {
+ },
+ "name": "hosts",
+ "providing": {
+ },
+ "description": "Configures /etc/hosts",
+ "maintainer": "Promet Solutions"
+ }
View
7 hosts/metadata.rb
@@ -0,0 +1,7 @@
+maintainer "Promet Solutions"
+maintainer_email "marius@promethost.com"
+license "Apache 2.0"
+description "Configures /etc/hosts"
+long_description IO.read(File.join(File.dirname(__FILE__), 'README.rdoc'))
+version "0.1"
+
View
26 hosts/recipes/default.rb
@@ -0,0 +1,26 @@
+#
+# Author:: Marius Ducea (marius@promethost.com)
+# Cookbook Name:: hosts
+# Recipe:: default
+#
+# Copyright 2010, Promet Solutions
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+template "/etc/hosts" do
+ source "hosts.erb"
+ owner "root"
+ group "root"
+ mode 0644
+end
View
15 hosts/templates/default/hosts.erb
@@ -0,0 +1,15 @@
+127.0.0.1 <%= node['fqdn'] %> <%= node['hostname'] %> localhost localhost.localdomain
+
+<% if node[:hosts] %>
+<% node[:hosts].sort.each do |ip, dns| %>
+<%= ip %> <%= dns %>
+<% end %>
+<% end %>
+
+# The following lines are desirable for IPv6 capable hosts
+::1 ip6-localhost ip6-loopback
+fe00::0 ip6-localnet
+ff00::0 ip6-mcastprefix
+ff02::1 ip6-allnodes
+ff02::2 ip6-allrouters
+ff02::3 ip6-allhosts

0 comments on commit 7c932e6

Please sign in to comment.