]> gitweb.fluxo.info Git - puppet-mysql.git/commitdiff
Refactoring for autoloading
authorSilvio Rhatto <rhatto@riseup.net>
Fri, 25 Jan 2013 18:08:13 +0000 (16:08 -0200)
committerSilvio Rhatto <rhatto@riseup.net>
Fri, 25 Jan 2013 18:08:13 +0000 (16:08 -0200)
manifests/init.pp
manifests/server.pp [new file with mode: 0644]

index cbb57e0c6890e40547bcad6054fc7898f54567b7..35dba041d4d47f8b87763c74bcd8fce681d55e97 100644 (file)
@@ -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 (file)
index 0000000..3b118f9
--- /dev/null
@@ -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'],
+    }
+  }
+}