dictionary.pp 1.21 KB
Newer Older
1
# Install FreeRADIUS custom dictionaries
2
define freeradius::dictionary (
3
4
  $source = undef,
  $content = undef,
5
6
7
  $order = 50,
  $ensure = present,
) {
8
9
  $fr_package  = $::freeradius::params::fr_package
  $fr_service  = $::freeradius::params::fr_service
10
  $fr_basepath = $::freeradius::params::fr_basepath
11
  $fr_group    = $::freeradius::params::fr_group
12

13
14
15
16
  if !$source and !$content {
    fail('source or content parameter should be provided')
  }

17
  # Install dictionary in dictionary.d
18
  file { "${fr_basepath}/dictionary.d/dictionary.${name}":
19
    ensure  => $ensure,
20
21
    mode    => '0644',
    owner   => 'root',
22
    group   => $fr_group,
23
    source  => $source,
24
    content => $content,
25
    require => [File["${fr_basepath}/dictionary.d"], Package[$fr_package], Group[$fr_group]],
26
27
28
29
30
    notify  => Service[$fr_service],
  }

  # Reference policy.d in the global includes file
  # If no order priority is given, assume 50
31
32
33
34
35
36
37
38

  if ($ensure == 'present') {
    concat::fragment { "dictionary.${name}":
      target  => "${fr_basepath}/dictionary",
      content => "\$INCLUDE ${fr_basepath}/dictionary.d/dictionary.${name}\n",
      order   => $order,
      require => File["${fr_basepath}/dictionary.d/dictionary.${name}"],
    }
39
40
  }
}