summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2013-01-25 16:08:13 -0200
committerSilvio Rhatto <rhatto@riseup.net>2013-01-25 16:08:13 -0200
commit4f54235167c5dce2150dfb1a37dab5d355782efd (patch)
tree203d1cb1b4781f6189f07d5b2ca7fb2ea64e90b8
parent8f23dc4b9e0cd86385d5c864dbac0e1ef550c700 (diff)
downloadpuppet-mysql-4f54235167c5dce2150dfb1a37dab5d355782efd.tar.gz
puppet-mysql-4f54235167c5dce2150dfb1a37dab5d355782efd.tar.bz2
Refactoring for autoloading
-rw-r--r--manifests/init.pp53
-rw-r--r--manifests/server.pp52
2 files changed, 52 insertions, 53 deletions
diff --git a/manifests/init.pp b/manifests/init.pp
index cbb57e0..35dba04 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -17,56 +17,3 @@ class mysql {
ensure => installed,
}
}
-
-class mysql::server(
- $rootpw => hiera('mysql::server::rootpw', '')
-){
- include mysql
-
- package { "mysql-server":
- ensure => installed,
- }
-
- service { "mysql":
- ensure => running,
- enable => true,
- hasrestart => true,
- hasstatus => true,
- require => Package["mysql-server"],
- }
-
- case $rootpw {
- '': { fail("You need to define a mysql root password! Please set mysql::server::rootpw config") }
- }
-
- file { '/usr/local/sbin/setmysqlpass.sh':
- content => template('mysql/setmysqlpass.sh.erb'),
- require => Service['mysql'],
- owner => root,
- group => root,
- mode => 0500,
- }
-
- exec { 'set_mysql_rootpw':
- command => "/usr/local/sbin/setmysqlpass.sh",
- require => [ File['/usr/local/sbin/setmysqlpass.sh'], Package[mysql-server] ],
- refreshonly => true,
- user => root,
- }
-
- mysql::cnf { "root":
- home => "/root",
- passwd => $rootpw,
- }
-
- define mysql::cnf($home, $passwd) {
- file { "$home/.my.cnf":
- content => template('mysql/my.cnf.erb'),
- require => Service['mysql'],
- owner => root,
- group => root,
- mode => 0400,
- notify => Exec['set_mysql_rootpw'],
- }
- }
-}
diff --git a/manifests/server.pp b/manifests/server.pp
new file mode 100644
index 0000000..3b118f9
--- /dev/null
+++ b/manifests/server.pp
@@ -0,0 +1,52 @@
+class mysql::server(
+ $rootpw => hiera('mysql::server::rootpw', '')
+){
+ include mysql
+
+ package { "mysql-server":
+ ensure => installed,
+ }
+
+ service { "mysql":
+ ensure => running,
+ enable => true,
+ hasrestart => true,
+ hasstatus => true,
+ require => Package["mysql-server"],
+ }
+
+ case $rootpw {
+ '': { fail("You need to define a mysql root password! Please set mysql::server::rootpw config") }
+ }
+
+ file { '/usr/local/sbin/setmysqlpass.sh':
+ content => template('mysql/setmysqlpass.sh.erb'),
+ require => Service['mysql'],
+ owner => root,
+ group => root,
+ mode => 0500,
+ }
+
+ exec { 'set_mysql_rootpw':
+ command => "/usr/local/sbin/setmysqlpass.sh",
+ require => [ File['/usr/local/sbin/setmysqlpass.sh'], Package[mysql-server] ],
+ refreshonly => true,
+ user => root,
+ }
+
+ mysql::cnf { "root":
+ home => "/root",
+ passwd => $rootpw,
+ }
+
+ define mysql::cnf($home, $passwd) {
+ file { "$home/.my.cnf":
+ content => template('mysql/my.cnf.erb'),
+ require => Service['mysql'],
+ owner => root,
+ group => root,
+ mode => 0400,
+ notify => Exec['set_mysql_rootpw'],
+ }
+ }
+}