Permalink
Browse files

nfs cookbook added

  • Loading branch information...
1 parent a85a8a0 commit d72e7b637dab4ff7fc83003b08b47f1a6844efa6 @mdxp committed Jul 30, 2011
View
@@ -0,0 +1,8 @@
+= DESCRIPTION:
+
+= REQUIREMENTS:
+
+= ATTRIBUTES:
+
+= USAGE:
+
View
@@ -0,0 +1,3 @@
+nfs Mash.new unless attribute?(:nfs)
+nfs[:exports] = Mash.new unless nfs.has_key?(:exports)
+nfs[:mounts] = Mash.new unless nfs.has_key?(:mounts)
View
@@ -0,0 +1,7 @@
+maintainer "Promet Solutions"
+maintainer_email "marius@promethost.com"
+license "Apache 2.0"
+description "Installs/Configures NFS"
+long_description IO.read(File.join(File.dirname(__FILE__), 'README.rdoc'))
+version "0.1"
+
View
@@ -0,0 +1,23 @@
+include_recipe "nfs::default"
+
+if node[:nfs] && node[:nfs][:mounts]
+ node[:nfs][:mounts].each do |target, config|
+ directory target do
+ recursive true
+ owner (config[:owner]||'root')
+ group (config[:owner]||'root')
+ end
+
+ mount target do
+ fstype "nfs"
+ options config[:options] || %w(rsize=32768,wsize=32768,bg,hard,nfsvers=3,intr,tcp,noatime,timeo=14)
+ device config[:device]
+ dump 0
+ pass 0
+ # mount and add to fstab. set to 'disable' to remove it
+ action [:enable, :mount]
+ end
+ end
+else
+ Chef::Log.warn "You included the NFS client recipe without defining nfs mounts."
+end
View
@@ -0,0 +1,23 @@
+package "portmap"
+
+service "portmap" do
+ action [ :enable, :start ]
+ running true
+ supports :status => false, :restart => true
+ action :nothing
+end
+
+template "/etc/default/portmap" do
+ source "portmap.erb"
+ owner "root"
+ group "root"
+ mode "0644"
+ notifies :restart, resources(:service => "portmap"), :immediately
+end
+
+package "nfs-common"
+service "nfs-common" do
+ action [ :enable, :start ]
+ running true
+ supports :status => true, :restart => true
+end
View
@@ -0,0 +1,21 @@
+package "nfs-kernel-server"
+
+if node[:nfs] && node[:nfs][:exports]
+ template "/etc/exports" do
+ source "exports.erb"
+ owner "root"
+ group "root"
+ mode 0644
+ end
+
+ #provide_service('nfs_server', node[:nfs][:exports].to_hash)
+
+ service "nfs-kernel-server" do
+ action [ :enable, :start ]
+ running true
+ supports :status => true, :restart => true
+ end
+
+else
+ Chef::Log.warn "You included the NFS server recipe without defining nfs exports: set node[:nfs][:exports]."
+end
@@ -0,0 +1,14 @@
+# /etc/exports: the access control list for filesystems which may be exported
+# to NFS clients. See exports(5).
+#
+# Example for NFSv2 and NFSv3:
+# /srv/homes hostname1(rw,sync) hostname2(ro,sync)
+#
+# Example for NFSv4:
+# /srv/nfs4 gss/krb5i(rw,sync,fsid=0,crossmnt)
+# /srv/nfs4/homes gss/krb5i(rw,sync)
+#
+
+<% @node[:nfs][:exports].each_key do |mount_point| -%>
+<%= mount_point %> <%= @node[:nfs][:exports][mount_point][:nfs_options] %>
+<% end %>
@@ -0,0 +1,14 @@
+# Portmap configuration file
+#
+# Note: if you manually edit this configuration file,
+# portmap configuration scripts will avoid modifying it
+# (for example, by running 'dpkg-reconfigure portmap').
+
+# If you want portmap to listen only to the loopback
+# interface, uncomment the following line (it will be
+# uncommented automatically if you configure this
+# through debconf).
+#OPTIONS="-i 127.0.0.1"
+<% if node[:recipes].include?("nfs::client") %>
+OPTIONS="-i 127.0.0.1"
+<% end %>

0 comments on commit d72e7b6

Please sign in to comment.