summaryrefslogtreecommitdiff
path: root/puppet/modules/site_apt/manifests/leap_repo.pp
blob: d3ab463d95a22c191eec241fc70fdbabb685d70a (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
31
32
33
34
35
36
37
38
39
# install leap deb repo together with leap-keyring package
# containing the apt signing key
class site_apt::leap_repo {
  $platform = hiera_hash('platform')
  $major_version = $platform['major_version']

  # on jessie, keys need to be in /etc/apt/...
  # see https://0xacab.org/leap/platform/issues/8862
  if ( $::operatingsystemmajrelease == '8' ) {
    if $::site_apt::apt_platform_component =~ /.*(staging|master).*/ {
      $archive_key = 'CE433F407BAB443AFEA196C1837C1AD5367429D9'
    } else {
      $archive_key = '1E453B2CE87BEE2F7DFE99661E34A1828E207901'
    }
  }
  if ( $::operatingsystemmajrelease != '8' ) {
    if $::site_apt::apt_platform_component =~ /.*(staging|master).*/ {
      $archive_key = '/usr/share/keyrings/leap-experimental-archive.gpg'
    } else {
      $archive_key = '/usr/share/keyrings/leap-archive.gpg'
    }
  }

  file {
    '/etc/apt/trusted.gpg.d/leap-archive.gpg':
      ensure => present,
      source => 'puppet:///modules/site_apt/keys/leap-archive.gpg';
    '/etc/apt/trusted.gpg.d/leap-experimental-archive.gpg':
      ensure => present,
      source => 'puppet:///modules/site_apt/keys/leap-experimental-archive.gpg'
  }


  apt::sources_list { 'leap.list':
    content => "deb [signed-by=${archive_key}] ${::site_apt::apt_url_platform_basic} ${::site_apt::apt_platform_component} ${::site_apt::apt_platform_codename}\n",
    before  => Exec[refresh_apt]
  }

}