Puppet Class: varnish::repo

Defined in:
manifests/repo.pp

Summary

This class installs aditional repos for varnish

Overview

Parameters:

  • version (Optional[String]) (defaults to: undef)

    Version of varnish for repo

  • enable (Boolean) (defaults to: false)

    If repo will be managed



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

class varnish::repo (
  Optional[String] $version  = undef,
  Boolean          $enable   = false,
) {
  $repo_base_url = 'https://packagecloud.io/varnishcache'

  $repo_distro = $facts['os']['name'] ? {
    'RedHat'    => 'redhat',
    'LinuxMint' => 'ubuntu',
    'centos'    => 'redhat',
    'amazon'    => 'redhat',
    'debian'    => 'ubuntu',
    default     => downcase($facts['os']['name']),
  }

  $repo_version = $version ? {
    /^4\.0/ => '4.0',
    /^4\.1/ => '4.1',
    default => '60lts',
  }

  if $enable {
    case $facts['os']['family'] {
      'redhat': {
        yumrepo { 'varnish':
          descr    => 'varnish',
          enabled  => '1',
          gpgcheck => '1',
          priority => '1',
          gpgkey   => "${repo_base_url}/varnish${repo_version}/gpgkey",
          baseurl  => "${repo_base_url}/varnish${repo_version}/el/${facts['os']['release']['major']}/${facts['os']['architecture']}",
        }
      }
      'debian': {
        apt::source { 'varnish':
          location => "${repo_base_url}/varnish${repo_version}/${repo_distro}/",
          repos    => "varnish-${repo_version}",
          key      => {
            id     => '48D81A24CB0456F5D59431D94CFCFD6BA750EDCD',
            source => "${repo_base_url}/varnish${repo_version}/gpgkey",
          },
        }
      }
      default: {
      }
    }
  }
}