Puppet Class: icingaweb2::repo

Defined in:
manifests/repo.pp

Overview

Class: icingaweb2::repo

This class manages the packages.icinga.com repository based on the operating system. Windows is not supported, as the Icinga Project does not offer a chocolate repository.

Warning: Make sure to not enable manage_repo on icinga2 as well, it will conflict.

Parameters

This class does not provide any parameters. To control the behaviour of this class, have a look at the parameters:

  • icingaweb2::manage_repo

Examples

This class is private and should not be called by others than this module.



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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# File 'manifests/repo.pp', line 19

class icingaweb2::repo {

  if defined($caller_module_name) and $module_name != $caller_module_name {
    fail("icingaweb2::repo is a private class of the module icingaweb2, you're not permitted to use it.")
  }

  if $::icingaweb2::manage_repo and $::icingaweb2::install_method == 'package' {

    if $::icingaweb2::pkg_repo_version and $::icingaweb2::pkg_repo_version != 'release' {
      fail('Setting pkg_repo_version is no longer supported!')
    }

    if (
      $::icingaweb2::pkg_repo_release_key or $::icingaweb2::pkg_repo_release_metadata_expire
      or $::icingaweb2::pkg_repo_release_url or
      $::icingaweb2::pkg_repo_snapshot_key or $::icingaweb2::pkg_repo_snapshot_metadata_expire
      or $::icingaweb2::pkg_repo_snapshot_url
    ) {
      fail('Setting pkg_* properties is no longer supported!')
    }

    case $::osfamily {
      'redhat': {
        case $::operatingsystem {
          'centos', 'redhat': {

            # removing old yumrepo names
            yumrepo { 'ICINGA-stable':
              ensure => absent,
            }

            yumrepo { 'icinga-stable-release':
              baseurl  => "http://packages.icinga.com/epel/${::operatingsystemmajrelease}/release/",
              descr    => 'ICINGA (stable release for epel)',
              enabled  => 1,
              gpgcheck => 1,
              gpgkey   => 'http://packages.icinga.com/icinga.key',
            }
          }
          default: {
            fail('Your plattform is not supported to manage a repository.')
          }
        }
      }
      'debian': {
        case $::operatingsystem {
          'debian': {
            include ::apt, ::apt::backports
            apt::source { 'icinga-stable-release':
              location    => 'http://packages.icinga.com/debian',
              release     => "icinga-${::lsbdistcodename}",
              repos       => 'main',
              key_source  => 'http://packages.icinga.com/icinga.key',
              key         => 'F51A91A5EE001AA5D77D53C4C6E319C334410682',
              include_src => false,
            }
          }
          'ubuntu': {
            include ::apt
            apt::source { 'icinga-stable-release':
              location    => 'http://packages.icinga.com/ubuntu',
              release     => "icinga-${::lsbdistcodename}",
              repos       => 'main',
              key_source  => 'http://packages.icinga.com/icinga.key',
              key         => 'F51A91A5EE001AA5D77D53C4C6E319C334410682',
              include_src => false,
            }
          }
          default: {
            fail('Your plattform is not supported to manage a repository.')
          }
        }
        contain ::apt::update
      }
      'suse': {

        file { '/etc/pki/GPG-KEY-icinga':
          ensure => present,
          source => 'http://packages.icinga.com/icinga.key',
        }

        exec { 'import icinga gpg key':
          path      => '/bin:/usr/bin:/sbin:/usr/sbin',
          command   => 'rpm --import /etc/pki/GPG-KEY-icinga',
          unless    => "rpm -q gpg-pubkey-`echo $(gpg --throw-keyids < /etc/pki/GPG-KEY-icinga) | cut --characters=11-18 | tr [A-Z] [a-z]`",
          require   => File['/etc/pki/GPG-KEY-icinga'],
          logoutput => 'on_failure',
        }

        case $::operatingsystem {
          'SLES': {
            zypprepo { 'icinga-stable-release':
              baseurl  => "http://packages.icinga.com/SUSE/${::operatingsystemmajrelease}/release/",
              enabled  => 1,
              gpgcheck => 1,
              require  => Exec['import icinga gpg key']
            }
          }
          default: {
            fail('Your plattform is not supported to manage a repository.')
          }
        }
      }
      'windows': {
        warning("The Icinga Project doesn't offer chocolaty packages at the moment.")
      }
      default: {
        fail('Your plattform is not supported to manage a repository.')
      }
    }

  } # if $::icinga::manage_repo

}