Added $tftp_datadir support to tftp server and fixed SELinux contexts from it.

Added tftp::client class.
This commit is contained in:
Timo Mkinen 2010-10-07 20:26:49 +03:00
parent 159dd74579
commit 235fc9e45e

View file

@ -1,10 +1,68 @@
# Install tftp server # Install tftp server
# #
# === Global variables:
#
# $tftp_datadir:
# Directory containing tftp files.
#
class tftp::server { class tftp::server {
include inetd::server include inetd::server
if $tftp_datadir {
file { "${tftp_datadir}":
ensure => directory,
mode => 0755,
owner => root,
group => root,
seltype => "tftpdir_t",
}
file { "/srv/tftpboot":
ensure => link,
target => "${tftp_datadir}",
seltype => "tftpdir_t",
require => File["${tftp_datadir}"],
}
} else {
file { "/srv/tftpboot":
ensure => directory,
mode => 0755,
owner => root,
group => root,
seltype => "tftpdir_t",
}
}
if $operatingsystem == "Fedora" {
file { "/var/lib/tftpboot":
ensure => link,
target => "/srv/tftpboot",
force => true,
require => File["/srv/tftpboot"],
}
} else {
file { "/tftpboot":
ensure => link,
target => "/srv/tftpboot",
force => true,
require => File["/srv/tftpboot"],
}
}
if $selinux {
selinux::manage_fcontext { "/srv/tftpboot(/.*)?":
type => "tftpdir_t",
before => File["/srv/tftpboot"],
}
if $tftp_datadir {
selinux::manage_fcontext { "${tftp_datadir}(/.*)?":
type => "tftpdir_t",
before => File["${tftp_datadir}"],
}
}
}
package { "tftp-server": package { "tftp-server":
ensure => installed, ensure => installed,
} }
@ -15,3 +73,14 @@ class tftp::server {
} }
} }
# Install tftp client tools
#
class tftp::client {
package { "tftp":
ensure => installed,
}
}