Permalink
Browse files

tftp cookbook

  • Loading branch information...
1 parent f91b868 commit b80b136bd91b3e6d93e86a9b2339b23ca2ef467d @mattray mattray committed May 7, 2011
Showing with 160 additions and 0 deletions.
  1. +37 −0 tftp/README.md
  2. +25 −0 tftp/attributes/default.rb
  3. +31 −0 tftp/metadata.rb
  4. +21 −0 tftp/recipes/default.rb
  5. +35 −0 tftp/recipes/server.rb
  6. +11 −0 tftp/templates/default/tftpd-hpa.erb
View
@@ -0,0 +1,37 @@
+Description
+===========
+Configures the Trivial File Transfer Protocol server `tftpd`. This cookbook may be used in conjunction with the `pxe_dust` to create PXE-bootable Ubuntu installs.
+
+Recipes
+=======
+
+default
+-------
+The default recipe passes through to the server recipe.
+
+server
+------
+The node will install and use the `tftpd` application to provide files via tftp. Typically those nodes will be requesting images via PXE and configured from their BIOS as clients, so there is not a client recipe yet.
+
+Usage
+=====
+Nodes using the `tftp::server` recipe will provide tftp access to whatever files are in their `[:tftp][:directory]`.
+
+License and Author
+==================
+
+Author:: Matt Ray (<matt@opscode.com>)
+
+Copyright 2011 Opscode, Inc.
+
+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.
View
@@ -0,0 +1,25 @@
+#
+# Author:: Matt Ray <matt@opscode.com>
+# Cookbook Name:: tftp
+# Attributes:: default
+#
+# Copyright 2011 Opscode, Inc
+#
+# 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.
+#
+
+default[:tftp][:username] = "tftp"
+default[:tftp][:directory] = "/var/lib/tftpboot"
+default[:tftp][:address] = "0.0.0.0:69"
+default[:tftp][:tftp_options] = "--secure"
+default[:tftp][:options] = "-l -s /var/lib/tftpboot"
View
@@ -0,0 +1,31 @@
+maintainer "Opscode, Inc."
+maintainer_email "matt@opscode.com"
+license "Apache 2.0"
+description "Installs/Configures tftpd"
+long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
+version "0.1.0"
+
+%w{ debian ubuntu }.each do |os|
+ supports os
+end
+
+attribute "tftp/username",
+ :display_name => "tftp user",
+ :default => "tftp"
+
+attribute "tftp/directory",
+ :display_name => "tftp directory",
+ :description => "Directory to be shared via tftp.",
+ :default => "/var/lib/tftpboot"
+
+attribute "tftp/address",
+ :display_name => "tftp address",
+ :default => "0.0.0.0:69"
+
+attribute "tftp/tftp_options",
+ :display_name => "tftp tftp_options",
+ :default => "--secure"
+
+attribute "tftp/options",
+ :display_name => "tftp options",
+ :default => "-l -s /var/lib/tftpboot"
View
@@ -0,0 +1,21 @@
+#
+# Author:: Matt Ray <matt@opscode.com>
+# Cookbook Name:: tftp
+# Recipe:: default
+#
+# Copyright 2011, Opscode, Inc
+#
+# 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.
+#
+
+include_recipe "tftp::server"
View
@@ -0,0 +1,35 @@
+#
+# Author:: Matt Ray <matt@opscode.com>
+# Cookbook Name:: tftp
+# Recipe:: server
+#
+# Copyright 2011, Opscode, Inc
+#
+# 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.
+#
+
+package "tftpd-hpa"
+
+service "tftpd-hpa" do
+ supports :restart => true, :status => true, :reload => true
+ action [ :enable ]
+end
+
+template "/etc/default/tftpd-hpa" do
+ owner "root"
+ group "root"
+ mode 0644
+ source "tftpd-hpa.erb"
+ notifies :restart, "service[tftpd-hpa]"
+end
+
@@ -0,0 +1,11 @@
+# /etc/default/tftpd-hpa
+#
+# Generated by Chef for <%= node[:fqdn] %>
+###
+
+TFTP_USERNAME="<%= node[:tftp][:username] %>"
+TFTP_DIRECTORY="<%= node[:tftp][:directory] %>"
+TFTP_ADDRESS="<%= node[:tftp][:address] %>"
+TFTP_OPTIONS="<%= node[:tftp][:tftp_options] %>"
+RUN_DAEMON="yes"
+OPTIONS="<%= node[:tftp][:options] %>"

0 comments on commit b80b136

Please sign in to comment.