Puppet Class: isp3node::mariadb::connect_master

Defined in:
manifests/mariadb/connect_master.pp

Summary

Connects instances to the ISPConfig Master Database

Overview

If this instance is a slave node, this class exports a mariadb user to be created on the master and be used during ISPConfig install and update

If it is the master, it realizes all exported users for creation

Examples:

include isp3node::mariadb::connect_master

Parameters:

  • user (String)

    username to add to the master DB for access from this host DO NOT USE root, this resource is already defined in mysql core setup and will cause puppet to fail. Beside that, do you want a privileged user root with external access?

  • password (String)

    Password for authentication to master servers database



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

class isp3node::mariadb::connect_master(
  String $user,
  String $password,
) {
  unless($facts['fqdn'] == lookup('isp3node::master')) {
    # Export Users to be created on the master node
    $users = [
      "${user}@${facts['fqdn']}",
      "${user}@${facts['networking']['ip']}",
      "${user}@${facts['networking']['ip6']}",
    ]
    @@mysql_user{$users:
      ensure        => present,
      tag           => ['isp3node-slave', 'isproot-on-master'],
      password_hash => mysql::password($password),
      }
    $users.each |$u| {
      @@mysql_grant{ "${u}/dbispconfig":
        ensure  => present,
        tag     => ['isp3node-slave', 'isproot-on-master'],
        user    => $u,
        require => Mysql_user[$u],
      }
    }
  }
  else {
    # Realize the exported users and grants
    Mysql_user <<| tag == 'isp3node-slave' and tag == 'isproot-on-master' |>>{
      max_user_connections     => 0,
      max_connections_per_hour => 0,
      max_updates_per_hour     => 0,
      max_queries_per_hour     => 0
    }
    Mysql_grant <<| tag == 'isp3node-slave' and tag == 'isproot-on-master' |>>{
      table      => 'dbispconfig',
      privileges => ['ALL'],
      options    => ['GRANT']
    }
  }
}