Puppet Class: kea::repo

Defined in:
manifests/repo.pp

Summary

Manages the ISC Cloudsmith repository for Kea packages.

Overview



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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'manifests/repo.pp', line 6

class kea::repo {
  assert_private()

  $repo_version = $kea::repo_version

  # Determine OS-specific repository details
  $os_codename = $facts['os']['distro']['codename']
  $os_name_lower = downcase($facts['os']['name'])

  # Repository configuration
  $repo_url = "https://dl.cloudsmith.io/public/isc/kea-${repo_version}/deb/${os_name_lower}"

  # ISC Cloudsmith GPG key details
  # Key ID B16C44CD45514C3C is used by Kea 3.0+
  $gpg_key_url = "https://dl.cloudsmith.io/public/isc/kea-${repo_version}/gpg.B16C44CD45514C3C.key"
  $keyring_path = '/etc/apt/keyrings/isc-kea.gpg'

  # Ensure keyrings directory exists
  file { '/etc/apt/keyrings':
    ensure => directory,
    owner  => 'root',
    group  => 'root',
    mode   => '0755',
  }

  # Download and dearmor the GPG key to the keyrings directory
  exec { "download-isc-kea-${repo_version}-key":
    command => "/usr/bin/curl -fsSL ${gpg_key_url} | /usr/bin/gpg --dearmor -o ${keyring_path}",
    creates => $keyring_path,
    require => File['/etc/apt/keyrings'],
  }

  # Set proper permissions on keyring
  file { $keyring_path:
    ensure  => file,
    owner   => 'root',
    group   => 'root',
    mode    => '0644',
    require => Exec["download-isc-kea-${repo_version}-key"],
  }

  # Add the repository using DEB822 format
  apt::source { "isc-kea-${repo_version}":
    source_format => 'sources',
    comment       => "ISC Kea ${repo_version} Repository",
    enabled       => true,
    types         => ['deb'],
    location      => [$repo_url],
    release       => [$os_codename],
    repos         => ['main'],
    keyring       => $keyring_path,
    notify_update => true,
    require       => File[$keyring_path],
  }
}