Puppet Class: zabbixagent::preinstall

Defined in:
manifests/preinstall.pp

Overview

Repositories used by Zabbix

Parameters:

  • manage_repo_epel (Any) (defaults to: $::zabbixagent::manage_repo_epel)
  • manage_repo_zabbix (Any) (defaults to: $::zabbixagent::manage_repo_zabbix)


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

class zabbixagent::preinstall (
  $manage_repo_epel   = $::zabbixagent::manage_repo_epel,
  $manage_repo_zabbix = $::zabbixagent::manage_repo_zabbix,) {
  case $::osfamily {
    RedHat  : {
      # EPEL
      if ($manage_repo_epel) {
        file { '/etc/yum.repos.d/epel.repo':
          ensure  => file,
          content => template('zabbixagent/epel.repo.erb'),
          notify  => Exec['yum clean all'],
        }

        file { '/etc/yum.repos.d/epel-testing.repo':
          ensure  => file,
          content => template('zabbixagent/epel-testing.repo.erb'),
          notify  => Exec['yum clean all'],
        }
      }

      # Zabbix
      if ($manage_repo_zabbix) {
        file { '/etc/yum.repos.d/zabbix.repo':
          ensure  => file,
          content => template('zabbixagent/zabbix.repo.erb'),
          notify  => Exec['yum clean all'],
        }
      }

      exec { 'yum clean all':
        path        => '/usr/bin',
        user        => 'root',
        logoutput   => true,
        refreshonly => true,
        command     => 'yum clean all',
      }

    } # end RedHat

    Debian  : {
      case $::operatingsystem {
        Ubuntu  : {
          # Zabbix
          if ($manage_repo_zabbix) {
            file { '/etc/apt/sources.list.d/zabbix.list':
              ensure  => file,
              content => template('zabbixagent/zabbix.list.erb'),
              notify  => Exec['apt-get update'],
            }

          }

        } # end Ubuntu

        default : {
        }

      } # end case $::operatingsystem



      exec { 'apt-get update':
        path        => '/usr/bin',
        user        => 'root',
        logoutput   => true,
        refreshonly => true,
        command     => 'apt-get update',
      }

    } # end Debian

    default : {
    }

  } # end case $::osfamily
}