Skip to content

Commit 2c54c11

Browse files
committed
support changing the user's authentication plugin for databases
1 parent 83a7ca2 commit 2c54c11

File tree

1 file changed

+20
-15
lines changed

1 file changed

+20
-15
lines changed

manifests/db.pp

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
# mysql::db { 'mydb':
66
# user => 'myuser',
77
# password => 'mypass',
8+
# plugin => 'caching_sha2_password',
89
# host => 'localhost',
910
# grant => ['SELECT', 'UPDATE'],
1011
# }
@@ -19,6 +20,8 @@
1920
# The user for the database you're creating.
2021
# @param password
2122
# The password for $user for the database you're creating.
23+
# @param plugin
24+
# The authentication plugin for $user for the database you're creating. Defaults to 'mysql_native_password'.
2225
# @param tls_options
2326
# The tls_options for $user for the database you're creating.
2427
# @param dbname
@@ -47,21 +50,22 @@
4750
# Specify the path in which mysql has been installed if done in the non-standard bin/sbin path.
4851
#
4952
define mysql::db (
50-
String[1] $user,
51-
Variant[String, Sensitive[String]] $password,
52-
Optional[Array[String[1]]] $tls_options = undef,
53-
String $dbname = $name,
54-
String[1] $charset = 'utf8',
55-
String[1] $collate = 'utf8_general_ci',
56-
String[1] $host = 'localhost',
57-
Variant[String[1], Array[String[1]]] $grant = 'ALL',
58-
Optional[Variant[String[1], Array[String[1]]]] $grant_options = undef,
59-
Optional[Array] $sql = undef,
60-
Boolean $enforce_sql = false,
61-
Enum['absent', 'present'] $ensure = 'present',
62-
Integer $import_timeout = 300,
63-
Enum['cat', 'zcat', 'bzcat'] $import_cat_cmd = 'cat',
64-
Optional[String] $mysql_exec_path = undef,
53+
String[1] $user,
54+
Variant[String, Sensitive[String]] $password,
55+
String[1] $plugin ='mysql_native_password',
56+
Optional[Array[String[1]]] $tls_options = undef,
57+
String $dbname = $name,
58+
String[1] $charset = 'utf8',
59+
String[1] $collate = 'utf8_general_ci',
60+
String[1] $host = 'localhost',
61+
Variant[String[1], Array[String[1]]] $grant = 'ALL',
62+
Optional[Variant[String[1], Array[String[1]]]] $grant_options = undef,
63+
Optional[Array] $sql = undef,
64+
Boolean $enforce_sql = false,
65+
Enum['absent', 'present'] $ensure = 'present',
66+
Integer $import_timeout = 300,
67+
Enum['cat', 'zcat', 'bzcat'] $import_cat_cmd = 'cat',
68+
Optional[String] $mysql_exec_path = undef,
6569
) {
6670
include 'mysql::client'
6771

@@ -103,6 +107,7 @@
103107
$user_resource = {
104108
ensure => $ensure,
105109
password_hash => Deferred('mysql::password', [$password]),
110+
plugin => $plugin,
106111
tls_options => $tls_options,
107112
}
108113
ensure_resource('mysql_user', "${user}@${host}", $user_resource)

0 commit comments

Comments
 (0)