view modules/mysql/manifests/server/monitor.pp @ 244:48d3a1948e4d

Update MySQL module
author IBBoard <dev@ibboard.co.uk>
date Sat, 21 Dec 2019 14:11:43 -0500
parents 956e484adc12
children
line wrap: on
line source

# @summary
#   This is a helper class to add a monitoring user to the database
#
# @param mysql_monitor_username
#   The username to create for MySQL monitoring.
# @param mysql_monitor_password
#   The password to create for MySQL monitoring.
# @param mysql_monitor_hostname
#   The hostname from which the monitoring user requests are allowed access.
#
class mysql::server::monitor (
  $mysql_monitor_username = '',
  $mysql_monitor_password = '',
  $mysql_monitor_hostname = ''
) {

  Anchor['mysql::server::end'] -> Class['mysql::server::monitor']

  mysql_user { "${mysql_monitor_username}@${mysql_monitor_hostname}":
    ensure        => present,
    password_hash => mysql::password($mysql_monitor_password),
    require       => Class['mysql::server::service'],
  }

  mysql_grant { "${mysql_monitor_username}@${mysql_monitor_hostname}/*.*":
    ensure     => present,
    user       => "${mysql_monitor_username}@${mysql_monitor_hostname}",
    table      => '*.*',
    privileges => [ 'PROCESS', 'SUPER' ],
    require    => Mysql_user["${mysql_monitor_username}@${mysql_monitor_hostname}"],
  }

}