aboutsummaryrefslogtreecommitdiff
path: root/manifests/subsystem/apt/repo.pp
blob: ca8f5e14bdfbad45b3bce43b3140575ac1c569a3 (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
27
28
29
30
define nodo::subsystem::apt::repo(
  $definition,
  $key_source,
  $ensure = present,
) {
  file { "/etc/apt/trusted.gpg.d/${name}.gpg":
    ensure  => $ensure,
    owner   => "root",
    group   => "root",
    mode    => "0644",
    source  => $key_source,
    notify  => Exec["apt-repo-auto-update-${name}"],
  }

  file { "/etc/apt/sources.list.d/${name}.list":
    ensure  => $ensure,
    owner   => "root",
    group   => "root",
    mode    => "0644",
    content => "${definition}\n",
    require => [ File["/etc/apt/trusted.gpg.d/${name}.gpg"], Package['apt-transport-https'] ],
    notify  => Exec["apt-repo-auto-update-${name}"],
  }

  exec { "apt-repo-auto-update-${name}":
    command     => "/usr/bin/apt-get update",
    user        => "root",
    refreshonly => true,
  }
}