-
-
Save rkhatibi/2906607 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define mysql::createdb { | |
exec { "create-${name}-db": | |
unless => "mysql -uroot -p${config::mysqlRootPassword} ${name}", | |
command => "mysql -uroot -p${config::mysqlRootPassword} -e \"create database ${name}; grant all on ${name}.* to ${config::dbUser}@localhost identified by '${config::dbPassword}';\"", | |
require => Service["mysql"], | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class mysql::databases { | |
mysql::createdb { "create-dev-db": | |
dbname => "specdit_dev", | |
user => "specdit", | |
password => "xxx", | |
} | |
mysql::createdb { "create-live-db": | |
dbname => "specdit_live", | |
user => "specdit", | |
password => "xxx", | |
} | |
mysql::createdb { "create-test-db": | |
dbname => "specdit_test", | |
user => "specdit", | |
password => "xxx", | |
} | |
mysql::createdb { "create-stage-db": | |
dbname => "specdit_stage", | |
user => "specdit", | |
password => "xxx", | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class mysql { | |
include mysql::databases | |
# Makee sure MySQL is installed. | |
package { 'mysql-server': | |
ensure => present, | |
require => Exec['apt-get update'] | |
} | |
# Make sure MySQL is started. | |
service { 'mysql': | |
ensure => running, | |
require => Package['mysql-server'], | |
} | |
# Set default MySQL root user password. | |
exec { 'set-mysql-passwrod': | |
unless => "mysqladmin -uroot -p${config::mysqlRootPassword} status", | |
command => "mysqladmin -uroot password ${config::mysqlRootPassword}", | |
require => Service['mysql'], | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment