summaryrefslogtreecommitdiff
path: root/manifests/preseeded_package.pp
blob: 29a981ee1537961fa4425a6ab8c9a9c1b625788f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# Install a package with a preseed file to automatically answer some questions.

define apt::preseeded_package (
  $ensure  = 'present',
  $content = '',
) {

  $seedfile = "/var/cache/local/preseeding/${name}.seeds"
  $real_content = $content ? {
    ''      => template ( "site_apt/${::debian_codename}/${name}.seeds" ),
    default => $content,
  }

  file { $seedfile:
    content => $real_content,
    mode    => '0600',
    owner   => 'root',
    group   => 0,
  }

  package { $name:
    ensure       => $ensure,
    responsefile => $seedfile,
    require      => File[$seedfile],
  }
}