Puppet Class: tungsten::tungstenmysql::tungstenrepo

Defined in:
manifests/tungstenmysql/tungstenrepo.pp

Overview

Parameters:

  • mySQLBuild (Any) (defaults to: false)
  • mySQLVersion (Any) (defaults to: false)


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

class tungsten::tungstenmysql::tungstenrepo (
  $mySQLBuild 							    = false,
  $mySQLVersion       			    = false
) {

  require tungsten::prereq::tungstenselinux
  if ($mySQLBuild !~ /(?i:percona|mariadb|mysql|native)/) {
    fail("The $mySQLBuild is not supported by this module")
  }

  if ($mySQLBuild  =~ /(?i:percona)/) {
    if ($operatingsystem =~ /(?i:centos|redhat|oel|OracleLinux|amazon)/) {
      if ($operatingsystem =~ /(?i:amazon)/) {
        $baseurl = "http://repo.percona.com/centos/${epel_version}/os/\$basearch/"
      } else {
        $baseurl = 'http://repo.percona.com/centos/$releasever/os/$basearch/'
      }

      yumrepo { 'percona':
        descr => 'CentOS $releasever - Percona',
        baseurl => $baseurl,
        gpgkey => 'http://www.percona.com/downloads/percona-release/RPM-GPG-KEY-percona',
        enabled => 1,
        gpgcheck => 1,
      }
    } elsif ($operatingsystem =~ /(?i:debian|ubuntu)/) {

      apt::source { 'percona':
        ensure => present,
        location => 'http://repo.percona.com/apt',
        release => $::lsbdistcodename,
        repos => 'main',
        key => "CD2EFD2A",
      }
    } else {
      fail("The Percona Repo  is not supported on an ${::operatingsystem} based system.")
    }
  }


  if ($mySQLBuild  =~ /(?i:mariadb)/) {
    if ($operatingsystem =~ /(?i:centos|redhat|oel|OracleLinux|amazon)/) {
      if ($operatingsystem =~ /(?i:amazon)/) {
        $baseurl = "http://yum.mariadb.org/${mySQLVersion}/centos${epel_version}-amd64"
      } else {
        $baseurl = "http://yum.mariadb.org/${mySQLVersion}/centos${operatingsystemmajrelease}-amd64"
      }

      yumrepo { 'mariadb':
        name => 'mariadb',
        baseurl => $baseurl,
        gpgkey => 'https://yum.mariadb.org/RPM-GPG-KEY-MariaDB',
        enabled => 1,
        gpgcheck => 1,
      }
    } elsif ($operatingsystem =~ /(?i:debian|ubuntu)/) {

      $tempos=downcase($operatingsystem)
      apt::source { 'mariadb':
        ensure => present,
        location => "http://mirrors.coreix.net/mariadb/repo/$mySQLVersion/$tempos",
        release => $::lsbdistcodename,
        repos => 'main',
        key => "0xcbcb082a1bb943db",
      }
    } else {
      fail("The mariaDB repo is not supported on an ${::operatingsystem} based system.")
    }
  }

  if ($mySQLBuild  =~ /(?i:mysql)/) {
      if ($operatingsystem =~ /(?i:centos|redhat|oel|OracleLinux|amazon)/) {
          if ($operatingsystem =~ /(?i:amazon)/) {
            $baseurl ="http://repo.mysql.com/yum/mysql-${mySQLVersion}-community/el/${epel_version}/\$basearch/"
          } else {
            $baseurl ="http://repo.mysql.com/yum/mysql-${mySQLVersion}-community/el/${operatingsystemmajrelease}/\$basearch/"
          }

          file { '/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql':
            ensure => file,
            mode	 => 644,
            owner	=> "root",
            group	=> "root",
            source => 'puppet:///modules/tungsten/RPM-GPG-KEY-mysql',
          }->
          yumrepo { 'mysql-community':
            name => 'mysql-community',
            baseurl => $baseurl,
            gpgkey => 'file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql',
            enabled => 1,
            gpgcheck => 1,
          }
      } elsif ($operatingsystem =~ /(?i:debian|ubuntu)/) {
        $tempos=downcase($operatingsystem)
        apt::source { 'mysql':
          ensure => present,
          location => "http://repo.mysql.com/apt/$tempos/",
          release => $::lsbdistcodename,
          repos => "mysql-$mySQLVersion",
          key => '5072E1F5'
        }
      } else {
        fail("The MySQL Repo module is not supported on an ${::operatingsystem} based system.")
      }
  }
}