aboutsummaryrefslogtreecommitdiff
path: root/manifests
diff options
context:
space:
mode:
authorNan Liu <nan@puppetlabs.com>2012-04-05 13:42:52 -0700
committerNan Liu <nan@puppetlabs.com>2012-04-05 13:42:52 -0700
commit89282064ac8de35a5154a80eedc5f7f2d8c5ba8a (patch)
tree9496a01faa9686b6348a6b09cf42187091c787e7 /manifests
downloadpuppet-tftp-89282064ac8de35a5154a80eedc5f7f2d8c5ba8a.tar.gz
puppet-tftp-89282064ac8de35a5154a80eedc5f7f2d8c5ba8a.tar.bz2
Initial commit.
Diffstat (limited to 'manifests')
-rw-r--r--manifests/file.pp30
-rw-r--r--manifests/init.pp38
-rw-r--r--manifests/params.pp36
3 files changed, 104 insertions, 0 deletions
diff --git a/manifests/file.pp b/manifests/file.pp
new file mode 100644
index 0000000..72c9ebd
--- /dev/null
+++ b/manifests/file.pp
@@ -0,0 +1,30 @@
+# Define: tftp::file
+#
+# Parameters:
+#
+# Actions:
+#
+# Requires:
+#
+# Usage:
+#
+define tftp::file (
+ $ensure = file,
+ $owner = 'tftp',
+ $group = 'tftp',
+ $mode = '0644',
+ $content = undef,
+ $source = undef
+) {
+ include 'tftp'
+
+ file { "${tftp::directory}/${name}":
+ ensure => $ensure,
+ owner => $owner,
+ group => $group,
+ mode => $mode,
+ content => $content,
+ source => $source,
+ require => Class['tftp'],
+ }
+}
diff --git a/manifests/init.pp b/manifests/init.pp
new file mode 100644
index 0000000..0a38297
--- /dev/null
+++ b/manifests/init.pp
@@ -0,0 +1,38 @@
+# Class: tftp
+#
+# Parameters:
+#
+# Actions:
+#
+# Requires:
+#
+# Usage:
+#
+class tftp (
+ $username = $tftp::params::username,
+ $directory = $tftp::params::directory,
+ $address = $tftp::params::address,
+ $port = $tftp::params::port,
+ $options = $tftp::params::options
+) inherits tftp::params {
+ package { 'tftpd-hpa':
+ ensure => present,
+ }
+
+ file { '/etc/default/tftpd-hpa':
+ ensure => file,
+ owner => 'root',
+ group => 'root',
+ mode => '0644',
+ content => template('tftp/tftpd-hpa.erb'),
+ require => Package['tftpd-hpa'],
+ }
+
+ service { 'tftpd-hpa':
+ ensure => running,
+ provider => $tftp::params::provider,
+ hasstatus => $tftp::params::hasstatus,
+ pattern => '/usr/sbin/in.tftpd',
+ subscribe => File['/etc/default/tftpd-hpa'],
+ }
+}
diff --git a/manifests/params.pp b/manifests/params.pp
new file mode 100644
index 0000000..df43e6c
--- /dev/null
+++ b/manifests/params.pp
@@ -0,0 +1,36 @@
+# Class: tftp::params
+#
+# Parameters:
+#
+# Actions:
+#
+# Requires:
+#
+# Usage:
+#
+class tftp::params {
+ $address = '0.0.0.0'
+ $port = '69'
+ $username = 'tftp'
+ $options = '--secure'
+
+ case $::operatingsystem {
+ 'debian': {
+ # hasstatus is to get around an issue where the service script appears to be broken.
+ $directory = '/srv/tftp'
+ $hasstatus = false
+ $provider = undef
+ }
+ 'ubuntu': {
+ $directory = '/var/lib/tftpboot'
+ $hasstatus = true
+ $provider = 'upstart'
+ }
+ default: {
+ warning("tftp:: module not verified on operatingsystem ${::operatingsystem}.")
+ $directory = '/var/lib/tftpboot'
+ $hasstatus = true
+ $provider = undef
+ }
+ }
+}