Puppet Class: bareos::install::repo

Defined in:
manifests/install/repo.pp

Overview

== Class: bareos::install::repo

This class contain the repository for bareos packages



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
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
# File 'manifests/install/repo.pp', line 5

class bareos::install::repo {

  case $::osfamily {
    'Debian' : {
      include ::apt

      Apt::Key <| |> -> Exec['apt_update']
      Apt::Source <| |> -> Exec['apt_update']

      Exec['apt_update'] -> Package <| |>

      apt::source { 'bareos':
        location => "http://download.bareos.org/bareos/release/latest/Debian_${::lsbmajdistrelease}.0/",
        repos    => '',
        release  => '/',
        key      => {
          'id'     => '0143857D9CE8C2D182FE2631F93C028C093BFBA2',
          'source' => "http://download.bareos.org/bareos/release/latest/Debian_${::lsbmajdistrelease}.0/Release.key",
        },
        notify   => Exec['apt_update'],
      }
    }
    'RedHat' : {
      # Define repository
      $bareos_version = '15-2'

      case $::lsbdistid {
        'CentOS': {
          $repository_file = "c${::lsbmajdistrelease}_${bareos_version}.repo"
        }
        default: {
          $repository_file = "rhel${::lsbmajdistrelease}_15-2.repo"
        }
      }
      $module_repository_file = "puppet:///modules/bareos/repo/${repository_file}"

      # Create client defintion
      file { $bareos::params::package_repository:
        ensure => file,
        mode   => '0644',
        notify => Exec['rpm-key-import', 'yum-update-cache'],
        source => $module_repository_file;
      }

      # yum/rpm configuration
      exec { 'rpm-key-import':
        command     => 'rpm --import http://download.bareos.org/bareos/release/15.2/CentOS_7/repodata/repomd.xml.key',
        path        => '/bin:/sbin:/usr/bin:/usr/sbin',
        refreshonly => true,
      }

      exec { 'yum-update-cache':
        command     => 'yum clean all && yum makecache',
        path        => '/bin:/sbin:/usr/bin:/usr/sbin',
        refreshonly => true,
      }
    }
    default : {
      warning ('os not (yet) supported!')
    }
  }
}