Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ## dbinstances.pp
- # Class: sites::dbinstances
- #
- #
- class sites::dbinstances {
- #include mysql::config
- $mysql_password = "bdfsdfsdf^a"
- define db( $user, $password ) {
- exec { "create-${name}-db":
- unless => "/usr/bin/mysql -uroot ${name}",
- command => "/usr/bin/mysql -uroot -e \"create database ${name};\"",
- require => Service["mysql"],
- }
- if ($environment != "prod") {
- exec { "grant-${name}-db":
- unless => "/usr/bin/mysql -u${user} -p${password} ${name}",
- command => "/usr/bin/mysql -uroot -e \"grant all privileges on ${name}.* to ${user}@'stage-web%' identified by '$password';\"",
- require => [Service["mysql"], Exec["create-${name}-db"]]
- }
- } else {
- exec { "grant-${name}-db":
- unless => "/usr/bin/mysql -u${user} -p${password} ${name}",
- command => "/usr/bin/mysql -uroot -e \"grant all privileges on ${name}.* to ${user}@'prod-web%' identified by '$password';\"",
- require => [Service["mysql"], Exec["create-${name}-db"]]
- }
- }
- }
- ## databases.pp
- db { 'testies':
- user => 'testicles',
- password => 'pHt8UlaPiiO0paVD',
- }
Add Comment
Please, Sign In to add comment