Skip to content
This repository was archived by the owner on Jun 11, 2019. It is now read-only.

Commit ec43f13

Browse files
committed
Merge pull request #58 from mburger/master
simple hiera support / make the root.my.cnf template into a var
2 parents 50770cb + 437b6b3 commit ec43f13

File tree

4 files changed

+21
-4
lines changed

4 files changed

+21
-4
lines changed

manifests/grant.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
) {
5050

5151
if $remote_host == '' {
52-
require mysql
52+
include mysql
5353
}
5454

5555
$dbname = $mysql_db ? {

manifests/init.pp

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,7 @@
223223
#
224224
class mysql (
225225
$root_password = params_lookup( 'root_password' ),
226+
$root_cnf_template = params_lookup( 'root_cnf_template' ),
226227
$password_salt = params_lookup( 'password_salt' ),
227228
$my_class = params_lookup( 'my_class' ),
228229
$source = params_lookup( 'source' ),
@@ -264,7 +265,9 @@
264265
$log_dir = params_lookup( 'log_dir' ),
265266
$log_file = params_lookup( 'log_file' ),
266267
$port = params_lookup( 'port' ),
267-
$protocol = params_lookup( 'protocol' )
268+
$protocol = params_lookup( 'protocol' ),
269+
$grants = params_lookup( 'grants' ),
270+
$users = params_lookup( 'users' )
268271
) inherits mysql::params {
269272

270273
$bool_source_dir_purge=any2bool($source_dir_purge)
@@ -415,6 +418,17 @@
415418
include $mysql::my_class
416419
}
417420

421+
### Create instances for integration with Hiera
422+
if $grants != {} {
423+
validate_hash($grants)
424+
create_resources(mysql::grant, $grants)
425+
}
426+
427+
if $users != {} {
428+
validate_hash($users)
429+
create_resources(mysql::user, $users)
430+
}
431+
418432

419433
### Provide puppi data, if enabled ( puppi => true )
420434
if $mysql::bool_puppi == true {

manifests/params.pp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
### Module specific parameters
1818
$root_password = ''
19+
$root_cnf_template = 'mysql/root.my.cnf.erb'
1920
$password_salt = ''
2021

2122
### Application related parameters
@@ -125,5 +126,7 @@
125126
$puppi_helper = 'standard'
126127
$debug = false
127128
$audit_only = false
129+
$grants = {}
130+
$users = {}
128131

129132
}

manifests/password.pp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
class mysql::password {
77

88
# Load the variables used in this module. Check the params.pp file
9-
require mysql
9+
include mysql
1010
require mysql::params
1111

1212
if ! defined(File['/root/.my.cnf']) {
@@ -16,7 +16,7 @@
1616
mode => '0400',
1717
owner => $mysql::config_file_owner,
1818
group => $mysql::config_file_group,
19-
content => template('mysql/root.my.cnf.erb'),
19+
content => template($mysql::root_cnf_template),
2020
# replace => false,
2121
# require => Exec['mysql_root_password'],
2222
}

0 commit comments

Comments
 (0)