Install userdir-ldap
[mirror/dsa-puppet.git] / modules / xinetd / manifests / service.pp
1 define xinetd::service (
2         $id,
3         $server,
4         $service,
5         $port='',
6         $bind='',
7         $type='',
8         $socket_type=stream,
9         $protocol=tcp,
10         $flags='',
11         $wait=no,
12         $user=root,
13         $group='',
14         $server_args='',
15         $nice=10,
16         $instances=100,
17         $per_source=3,
18         $cps='0 0',
19         $ensure=present,
20         $ferm=true
21 ) {
22         include xinetd
23
24         file { "/etc/xinetd.d/${name}":
25                 ensure  => $ensure,
26                 content => template('xinetd/service.erb'),
27                 notify  => Service['xinetd'],
28                 require => Package['xinetd'],
29         }
30
31         if $ferm {
32                 $fermport = $port ? {
33                         "" => $service,
34                         default => $port
35                 }
36
37                 @ferm::rule { "dsa-xinetd-${name}":
38                         description => "Allow traffic to ${service}",
39                         rule        => "&SERVICE(${protocol}, ${fermport})"
40                 }
41         }
42 }