module.pp 1.17 KB
Newer Older
1
# Install FreeRADIUS modules
2
define freeradius::module (
3
4
  $source = undef,
  $content = undef,
5
  $ensure = present,
6
  $preserve = false,
7
) {
8
9
  $fr_package  = $::freeradius::params::fr_package
  $fr_service  = $::freeradius::params::fr_service
10
  $fr_modulepath = $::freeradius::params::fr_modulepath
11
  $fr_basepath = $::freeradius::params::fr_basepath
12
  $fr_group    = $::freeradius::params::fr_group
13

Angel L. Mateo's avatar
Angel L. Mateo committed
14
15
16
17
18
  $ensure_link = $ensure ? {
    'absent' => 'absent',
    default  => 'link'
  }

19
20
21
  if ($preserve) {
    # Symlink to mods-available for stock modules
    file { "${fr_modulepath}/${name}":
Angel L. Mateo's avatar
Angel L. Mateo committed
22
      ensure => $ensure_link,
Jonathan Gazeley's avatar
Jonathan Gazeley committed
23
      target => "../mods-available/${name}",
24
25
    }
  } else {
26
27
    # Deploy actual module to mods-available, and link it to mods-enabled
    file { "${fr_basepath}/mods-available/${name}":
28
29
30
31
32
33
34
35
36
      ensure  => $ensure,
      mode    => '0640',
      owner   => 'root',
      group   => $fr_group,
      source  => $source,
      content => $content,
      require => [Package[$fr_package], Group[$fr_group]],
      notify  => Service[$fr_service],
    }
37
    file { "${fr_modulepath}/${name}":
Angel L. Mateo's avatar
Angel L. Mateo committed
38
      ensure => $ensure_link,
39
40
      target => "../mods-available/${name}",
    }
41
42
  }
}