Puppet Class: proxysql::params

Inherited by:
proxysql
Defined in:
manifests/params.pp

Summary

It sets variables according to platform.

Overview



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
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
# File 'manifests/params.pp', line 4

class proxysql::params {
  $datadir = '/var/lib/proxysql'

  case $facts['os']['family'] {
    'Debian': {
      $package_provider = 'dpkg'
      $package_dependencies = []

      if versioncmp(fact('os.release.major'), '18.04') == 0 {
        # The 2.0.x systemd service file in ubuntu 18.04 has `ReadWritePaths=/var/lib/proxysql /var/run/proxysql`.
        # This limits where we can write sockets.
        $_listen_socket = "${datadir}/proxysql.sock"
        $_admin_listen_socket = "${datadir}/proxysql_admin.sock"
      }

      $repo22 = {
        comment  => 'ProxySQL 2.2.x APT repository',
        location => "http://repo.proxysql.com/ProxySQL/proxysql-2.2.x/${facts['os']['distro']['codename']}/",
        release  => './',
        repos    => ' ',
        key      => {
          'name'   => 'proxysql-2.2.x.asc',
          'source' => 'https://repo.proxysql.com/ProxySQL/proxysql-2.2.x/repo_pub_key',
        },
      }
      $repo23 = {
        comment  => 'ProxySQL 2.3.x APT repository',
        location => "http://repo.proxysql.com/ProxySQL/proxysql-2.3.x/${facts['os']['distro']['codename']}/",
        release  => './',
        repos    => ' ',
        key      => {
          'name'   => 'proxysql-2.3.x.asc',
          'source' => 'https://repo.proxysql.com/ProxySQL/proxysql-2.3.x/repo_pub_key',
        },
      }
      $repo24 = {
        comment  => 'ProxySQL 2.4.x APT repository',
        location => "http://repo.proxysql.com/ProxySQL/proxysql-2.4.x/${facts['os']['distro']['codename']}/",
        release  => './',
        repos    => ' ',
        key      => {
          'name'   => 'proxysql-2.4.x.asc',
          'source' => 'https://repo.proxysql.com/ProxySQL/proxysql-2.4.x/repo_pub_key',
        },
      }
      $repo25 = {
        comment  => 'ProxySQL 2.5.x APT repository',
        location => "http://repo.proxysql.com/ProxySQL/proxysql-2.5.x/${facts['os']['distro']['codename']}/",
        release  => './',
        repos    => ' ',
        key      => {
          'name'   => 'proxysql-2.5.x.asc',
          'source' => 'https://repo.proxysql.com/ProxySQL/proxysql-2.5.x/repo_pub_key',
        },
      }
      $repo26 = {
        comment  => 'ProxySQL 2.6.x APT repository',
        location => "http://repo.proxysql.com/ProxySQL/proxysql-2.6.x/${facts['os']['distro']['codename']}/",
        release  => './',
        repos    => ' ',
        key      => {
          'name'   => 'proxysql-2.6.x.asc',
          'source' => 'https://repo.proxysql.com/ProxySQL/proxysql-2.6.x/repo_pub_key',
        },
      }
      $repo27 = {
        comment  => 'ProxySQL 2.7.x APT repository',
        location => "http://repo.proxysql.com/ProxySQL/proxysql-2.7.x/${facts['os']['distro']['codename']}/",
        release  => './',
        repos    => ' ',
        key      => {
          'name'   => 'proxysql-2.7.x.asc',
          'source' => 'https://repo.proxysql.com/ProxySQL/proxysql-2.7.x/repo_pub_key',
        },
      }
    }
    'RedHat': {
      $package_provider = 'rpm'
      $package_dependencies = ['perl-DBI', 'perl-DBD-mysql']
      $repo_os_major_version = $facts['os']['release']['major'] ? {
        '2016'  => '6',
        default => $facts['os']['release']['major'],
      }
      $repo22             = {
        name     => 'proxysql_2_2',
        descr    => 'ProxySQL 2.2.x YUM repository',
        baseurl  => "http://repo.proxysql.com/ProxySQL/proxysql-2.2.x/centos/${repo_os_major_version}",
        enabled  => true,
        gpgcheck => true,
        gpgkey   => 'http://repo.proxysql.com/ProxySQL/repo_pub_key',
      }
      $repo23             = {
        name     => 'proxysql_2_3',
        descr    => 'ProxySQL 2.3.x YUM repository',
        baseurl  => "http://repo.proxysql.com/ProxySQL/proxysql-2.3.x/centos/${repo_os_major_version}",
        enabled  => true,
        gpgcheck => true,
        gpgkey   => 'http://repo.proxysql.com/ProxySQL/repo_pub_key',
      }
      $repo24             = {
        name     => 'proxysql_2_4',
        descr    => 'ProxySQL 2.4.x YUM repository',
        baseurl  => "http://repo.proxysql.com/ProxySQL/proxysql-2.4.x/centos/${repo_os_major_version}",
        enabled  => true,
        gpgcheck => true,
        gpgkey   => 'http://repo.proxysql.com/ProxySQL/repo_pub_key',
      }
      $repo25             = {
        name     => 'proxysql_2_5',
        descr    => 'ProxySQL 2.5.x YUM repository',
        baseurl  => "http://repo.proxysql.com/ProxySQL/proxysql-2.5.x/centos/${repo_os_major_version}",
        enabled  => true,
        gpgcheck => true,
        gpgkey   => 'http://repo.proxysql.com/ProxySQL/repo_pub_key',
      }
      $repo26             = {
        name     => 'proxysql_2_6',
        descr    => 'ProxySQL 2.6.x YUM repository',
        baseurl  => "http://repo.proxysql.com/ProxySQL/proxysql-2.6.x/centos/${repo_os_major_version}",
        enabled  => true,
        gpgcheck => true,
        gpgkey   => 'http://repo.proxysql.com/ProxySQL/repo_pub_key',
      }
      $repo27             = {
        name     => 'proxysql_2_7',
        descr    => 'ProxySQL 2.7.x YUM repository',
        baseurl  => "http://repo.proxysql.com/ProxySQL/proxysql-2.7.x/centos/${repo_os_major_version}",
        enabled  => true,
        gpgcheck => true,
        gpgkey   => 'http://repo.proxysql.com/ProxySQL/repo_pub_key',
      }
    }
    default: {
      fail("osfamily ${facts['os']['family']} is not supported")
    }
  }

  if fact('proxysql_version') {
    $short_proxysql_version_fact = regsubst(fact('proxysql_version'),'^(\\d+\\.\\d+\\.\\d+)','\\1')
  } else {
    $short_proxysql_version_fact = undef
  }
  $version = pick($short_proxysql_version_fact,'2.7.1')

  $listen_socket = pick(getvar('_listen_socket'),'/tmp/proxysql.sock')
  $admin_listen_socket = pick(getvar('_admin_listen_socket'),'/tmp/proxysql_admin.sock')
}