diff --git a/tftp/manifests/init.pp b/tftp/manifests/init.pp index e4ce70b..2d62484 100644 --- a/tftp/manifests/init.pp +++ b/tftp/manifests/init.pp @@ -1,10 +1,68 @@ # Install tftp server # +# === Global variables: +# +# $tftp_datadir: +# Directory containing tftp files. +# class tftp::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": ensure => installed, } @@ -15,3 +73,14 @@ class tftp::server { } } + + +# Install tftp client tools +# +class tftp::client { + + package { "tftp": + ensure => installed, + } + +}