Revision 570e8e3f
Added by Greg Sutcliffe about 12 years ago
manifests/config.pp | ||
---|---|---|
class tftp::config {
|
||
file {'/etc/xinetd.d/tftp':
|
||
content => template('tftp/xinetd-tftp'),
|
||
mode => '0644',
|
||
require => [Class['tftp::install'], Class['xinetd::install']],
|
||
notify => Class['xinetd::service']
|
||
}
|
||
file {'/etc/tftpd.map':
|
||
content => template('tftp/tftpd.map'),
|
||
mode => '0644',
|
||
require => [Class['tftp::install'], Class['xinetd::install']],
|
||
notify => Class['xinetd::service']
|
||
}
|
||
|
||
case $tftp::params::daemon {
|
||
true: { } # not needed for daemon-mode
|
||
false: {
|
||
include xinetd
|
||
file {'/etc/xinetd.d/tftp':
|
||
content => template('tftp/xinetd-tftp'),
|
||
mode => '0644',
|
||
require => [Class['tftp::install'], Class['xinetd::install']],
|
||
notify => Class['xinetd::service']
|
||
}
|
||
|
||
file {'/etc/tftpd.map':
|
||
content => template('tftp/tftpd.map'),
|
||
mode => '0644',
|
||
require => [Class['tftp::install'], Class['xinetd::install']],
|
||
notify => Class['xinetd::service']
|
||
}
|
||
|
||
file { $tftp::params::root:
|
||
ensure => directory,
|
||
notify => Class['xinetd::service'],
|
||
file { $tftp::params::root:
|
||
ensure => directory,
|
||
notify => Class['xinetd::service'],
|
||
}
|
||
}
|
||
}
|
||
}
|
manifests/init.pp | ||
---|---|---|
class tftp {
|
||
include xinetd
|
||
include tftp::params
|
||
include tftp::install
|
||
include tftp::config
|
||
include tftp::service
|
||
}
|
manifests/install.pp | ||
---|---|---|
$tftp_package = 'tftp-server'
|
||
}
|
||
Debian: {
|
||
$tftp_package = 'atftpd'
|
||
$tftp_package = 'tftpd-hpa'
|
||
}
|
||
default: {
|
||
fail("${::hostname}: This module does not support operatingsystem ${::operatingsystem}")
|
manifests/params.pp | ||
---|---|---|
class tftp::params {
|
||
$root = '/tftpboot'
|
||
case $::operatingsystem {
|
||
Debian: {
|
||
$root = "/srv/tftp"
|
||
$daemon = true
|
||
$service = 'tftpd-hpa'
|
||
}
|
||
default: {
|
||
$root = '/tftpboot'
|
||
$daemon = false
|
||
}
|
||
}
|
||
}
|
manifests/service.pp | ||
---|---|---|
class tftp::service {
|
||
|
||
# No service needed if not daemonized
|
||
case $tftp::params::daemon {
|
||
false: { }
|
||
true: {
|
||
service { "$tftp::params::service":
|
||
ensure => running,
|
||
enable => true,
|
||
alias => "tftpd",
|
||
subscribe => Class['tftp::config'],
|
||
}
|
||
}
|
||
}
|
||
}
|
Also available in: Unified diff
Enable daemonized TFTP server