diff --git a/manifests/grant.pp b/manifests/grant.pp index b211801..f4616d1 100644 --- a/manifests/grant.pp +++ b/manifests/grant.pp @@ -49,7 +49,7 @@ ) { if $remote_host == '' { - require mysql + include mysql } $dbname = $mysql_db ? { diff --git a/manifests/init.pp b/manifests/init.pp index f569627..9e7f917 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -223,6 +223,7 @@ # class mysql ( $root_password = params_lookup( 'root_password' ), + $root_cnf_template = params_lookup( 'root_cnf_template' ), $password_salt = params_lookup( 'password_salt' ), $my_class = params_lookup( 'my_class' ), $source = params_lookup( 'source' ), @@ -264,7 +265,9 @@ $log_dir = params_lookup( 'log_dir' ), $log_file = params_lookup( 'log_file' ), $port = params_lookup( 'port' ), - $protocol = params_lookup( 'protocol' ) + $protocol = params_lookup( 'protocol' ), + $grants = params_lookup( 'grants' ), + $users = params_lookup( 'users' ) ) inherits mysql::params { $bool_source_dir_purge=any2bool($source_dir_purge) @@ -415,6 +418,17 @@ include $mysql::my_class } + ### Create instances for integration with Hiera + if $grants != {} { + validate_hash($grants) + create_resources(mysql::grant, $grants) + } + + if $users != {} { + validate_hash($users) + create_resources(mysql::user, $users) + } + ### Provide puppi data, if enabled ( puppi => true ) if $mysql::bool_puppi == true { diff --git a/manifests/params.pp b/manifests/params.pp index 4092f1e..db7a697 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -16,6 +16,7 @@ ### Module specific parameters $root_password = '' + $root_cnf_template = 'mysql/root.my.cnf.erb' $password_salt = '' ### Application related parameters @@ -125,5 +126,7 @@ $puppi_helper = 'standard' $debug = false $audit_only = false + $grants = {} + $users = {} } diff --git a/manifests/password.pp b/manifests/password.pp index 6f89efd..18bc9af 100644 --- a/manifests/password.pp +++ b/manifests/password.pp @@ -6,7 +6,7 @@ class mysql::password { # Load the variables used in this module. Check the params.pp file - require mysql + include mysql require mysql::params if ! defined(File['/root/.my.cnf']) { @@ -16,7 +16,7 @@ mode => '0400', owner => $mysql::config_file_owner, group => $mysql::config_file_group, - content => template('mysql/root.my.cnf.erb'), + content => template($mysql::root_cnf_template), # replace => false, # require => Exec['mysql_root_password'], }