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

simple hiera support / make the root.my.cnf template into a var #58

Merged
merged 4 commits into from
Mar 13, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion manifests/grant.pp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
) {

if $remote_host == '' {
require mysql
include mysql
}

$dbname = $mysql_db ? {
Expand Down
16 changes: 15 additions & 1 deletion manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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' ),
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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 {
Expand Down
3 changes: 3 additions & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

### Module specific parameters
$root_password = ''
$root_cnf_template = 'mysql/root.my.cnf.erb'
$password_salt = ''

### Application related parameters
Expand Down Expand Up @@ -125,5 +126,7 @@
$puppi_helper = 'standard'
$debug = false
$audit_only = false
$grants = {}
$users = {}

}
4 changes: 2 additions & 2 deletions manifests/password.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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']) {
Expand All @@ -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'],
}
Expand Down