view modules/mysql/manifests/server/root_password.pp @ 26:58d1818c2ded puppet-3.6

Update MySQL module (which adds "staging" module)
author IBBoard <dev@ibboard.co.uk>
date Mon, 09 Mar 2015 01:34:59 +0000
parents 956e484adc12
children 48d3a1948e4d
line wrap: on
line source

#
class mysql::server::root_password {

  $options = $mysql::server::options

  # manage root password if it is set
  if $mysql::server::create_root_user == true and $mysql::server::root_password != 'UNSET' {
    mysql_user { 'root@localhost':
      ensure        => present,
      password_hash => mysql_password($mysql::server::root_password),
    }
  }

  if $mysql::server::create_root_my_cnf == true and $mysql::server::root_password != 'UNSET' {
    file { "${::root_home}/.my.cnf":
      content => template('mysql/my.cnf.pass.erb'),
      owner   => 'root',
      mode    => '0600',
    }
    if $mysql::server::create_root_user == true {
      Mysql_user['root@localhost'] -> File["${::root_home}/.my.cnf"]
    }
  }

}