Puppet Class: icinga2::repo

Defined in:
manifests/repo.pp

Overview

== Class: icinga2::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.

=== Parameters

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

  • icinga2::manage_repo

=== Examples

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



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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'manifests/repo.pp', line 17

class icinga2::repo {

  assert_private()

  if $::icinga2::manage_repo and $::icinga2::manage_package {

    $repo =  lookup('icinga2::repo', Hash, 'deep', {})

    case $::osfamily {
      'redhat': {
        yumrepo { 'icinga-stable-release':
          * => $repo,
        }
        Yumrepo['icinga-stable-release'] -> Package<|tag == 'icinga2'|>
      }

      'debian': {
        # handle icinga stable repo before all package resources
        # contain class problem!
        Apt::Source['icinga-stable-release'] -> Package <| tag == 'icinga2' |>
        Class['Apt::Update'] -> Package<|tag == 'icinga2'|>

        include ::apt

        apt::source { 'icinga-stable-release':
          * => $repo,
        }
      }

      'suse': {

        Zypprepo['icinga-stable-release'] -> Package <| tag == 'icinga2' |>

        if $repo['proxy'] {
          $_proxy = "--httpproxy ${repo['proxy']}"
        } else {
          $_proxy = undef
        }

        exec { 'import icinga gpg key':
          path      => '/bin:/usr/bin:/sbin:/usr/sbin',
          command   => "rpm ${_proxy} --import ${repo['gpgkey']}",
          unless    => 'rpm -q gpg-pubkey-34410682',
          logoutput => 'on_failure',
        }

        -> zypprepo { 'icinga-stable-release':
          * => delete($repo, 'proxy'),
        }

        -> file_line { 'add proxy settings to icinga repo':
          path => '/etc/zypp/repos.d/icinga-stable-release.repo',
          line => "proxy=${repo['proxy']}",
        }
      }

      '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

}