Defined Type: mariadb::config::client

Defined in:
modules/mariadb/manifests/config/client.pp

Overview

Define mariadb::config::client

Convenience wrapper for mariadb::config::file that only set a few [client] settings. You must set at least one of user, pass, host or port.

Usage

mariadb::config::client { 'myuser':
    user => 'myser',
    pass => 'mypass',
}

This will render /etc/mysql/conf.d/myuser-client.cnf with the content:

[client]
user = myuser
password = mypass
#host =
#port =

You can also set host and port if you like.

Parameters

[*user*]        - MySQL user to use for this client connection.
[*pass*]        - MySQL password to use for this client connection.
[*host*]        - MySQL host to use to for this client connection.
[*port*]        = MySQL port to use for this client connection.

[*path*]        - Path at which to create the file.  Default: /etc/mysql/conf.d/${title}-client.cnf
[*owner*]       - Owner of the file.  Default: root
[*group*]       - Group owner of the file.  Default: root
[*mode*]        - File mode.  Default: 0444
[*template*]    - Template to use to render the file.  Default: mariadb/my.conf.cnf.erb
[*ensure*]      - Either 'present' or 'absent'.  Default: present.

Parameters:

  • user (Any) (defaults to: false)
  • pass (Any) (defaults to: false)
  • host (Any) (defaults to: false)
  • port (Any) (defaults to: false)
  • path (Any) (defaults to: "/etc/mysql/conf.d/${title}-client.cnf")
  • owner (Any) (defaults to: 'root')
  • group (Any) (defaults to: 'root')
  • mode (Any) (defaults to: '0444')
  • template (Any) (defaults to: 'mariadb/my.conf.cnf.erb')
  • ensure (Any) (defaults to: 'present')


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
# File 'modules/mariadb/manifests/config/client.pp', line 34

define mariadb::config::client(
    $user     = false,
    $pass     = false,
    $host     = false,
    $port     = false,
    $path     = "/etc/mysql/conf.d/${title}-client.cnf",
    $owner    = 'root',
    $group    = 'root',
    $mode     = '0444',
    $template = 'mariadb/my.conf.cnf.erb',
    $ensure   = 'present',
)
{
    if !($user or $pass or $host or $port) {
        fail('mariadb::config::client needs at least one of user, pass, host, or port to be set.')
    }

    mariadb::config::file { "${title}-client":
        ensure   => $ensure,
        settings => {
            'client' => {
                'user'     => $user,
                'password' => $pass,
                'host'     => $host,
                'port'     => $port,
            },
        },
        path     => $path,
        owner    => $owner,
        group    => $group,
        mode     => $mode,
        template => $template,
    }
}