Defined Type: pxe::menu

Defined in:
manifests/menu.pp

Overview

Parameters:

  • file (Any)
  • back (Any) (defaults to: 'Main Menu')
  • append (Any) (defaults to: 'pxelinux.cfg/default')
  • template (Any) (defaults to: 'pxe/menu.erb')
  • root (Any) (defaults to: 'default')


9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'manifests/menu.pp', line 9

define pxe::menu (
  $file,
  $back     = 'Main Menu',
  $append   = 'pxelinux.cfg/default',
  $template = 'pxe/menu.erb',
  $root     = 'default',
) {

  $tftp_root = $pxe::tftp_root
  $fullpath  = "${tftp_root}/pxelinux.cfg"

  concat::fragment { "menu_${name}-header":
    order   => '00',
    target  => "${fullpath}/${file}",
    content => template($template),
  }

  if !defined(Concat["${fullpath}/${file}"]) {
    concat { "${fullpath}/${file}": }
  }

  # If we are adding the root entry, then there is no need to reference this
  # from elsewhere.
  if $file != $root {
    pxe::menu::entry { $name:
      file   => $root,
      append => "pxelinux.cfg/${file}",
    }
  }

  if $root == 'default' {
    if !defined(Concat["${fullpath}/${root}"]) {
      concat { "${fullpath}/${root}": }
    }
  }
}