1 define site::aptrepo ($key = undef, $keyid = undef, $template = undef, $config = undef, $ensure = present) {
7 exec { "apt-key-update-${name}":
8 command => "apt-key add /etc/apt/trusted-keys.d/${name}.asc",
12 file { "/etc/apt/trusted-keys.d/${name}.asc":
15 notify => Exec["apt-key-update-${name}"]
20 if ($keyid) and ($key) {
21 file { "/etc/apt/trusted-keys.d/${name}.asc":
23 notify => Exec["apt-key-del-${keyid}"]
25 exec { "apt-key-del-${keyid}":
26 command => "apt-key del ${keyid}",
30 file { "/etc/apt/trusted-keys.d/${name}.asc":
34 exec { "apt-key-del-${keyid}":
35 command => "apt-key del ${keyid}",
39 default: { fail ( "Unknown ensure value: '$ensure'" ) }
42 if $ensure == present {
43 if ! ($config or $template) {
44 fail ( "No configuration found for ${name}" )
49 file { "/etc/apt/sources.list.d/${name}.list":
51 content => template($template),
52 notify => Exec['apt-get update'],
55 file { "/etc/apt/sources.list.d/${name}.list":
58 notify => Exec['apt-get update'],