Skip to content

Commit

Permalink
code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
pirog committed Oct 13, 2012
1 parent d677fa6 commit 6eb456b
Show file tree
Hide file tree
Showing 58 changed files with 378 additions and 60 deletions.
8 changes: 8 additions & 0 deletions manifests/site.pp
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/**
*
* This will build a basic LEMP stack with some extra goodies for every node that connects to the puppetmaster
* at kalabox.kalamuna.com
*
*/

node "default" {

# initialize core packages
Expand Down Expand Up @@ -27,4 +34,5 @@
enabled => "FALSE",
custom => "# THIS IS MEANT TO BE USED FOR BUILDING OTHER DRUPAL VHOSTS"
}

}
14 changes: 8 additions & 6 deletions modules/drupal/manifests/nginx/vhost.pp
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
*
* This is a basic definition for creating a drupal based nginx vhost file
*
*/

define drupal::nginx::vhost (
$vhost = $title,
Expand All @@ -12,6 +17,7 @@

include nginx

# Enable the site if enabled = true
if ($enabled == TRUE) {
file { "/etc/nginx/sites-enabled/${vhost}":
ensure => link,
Expand All @@ -28,6 +34,8 @@
notify => Class["nginx::service"],
}
}

# Only make the site available
else {
file { "/etc/nginx/sites-available/${vhost}":
ensure => file,
Expand All @@ -37,10 +45,4 @@
}
}

file { $root:
ensure => "directory",
owner => "www-data",
group => "www-data",
mode => 755,
}
}
5 changes: 5 additions & 0 deletions modules/drush/manifests/config.pp
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
*
* Provides some custom drush commands
*
*/
class drush::config {

file { "/usr/share/drush/commands/kala":
Expand Down
8 changes: 7 additions & 1 deletion modules/drush/manifests/init.pp
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@

/**
*
* Installs drush and provides some custom commands
*
*/
class drush {

include drush::install, drush::config

}
7 changes: 6 additions & 1 deletion modules/drush/manifests/install.pp
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@

/**
*
* Installs drush
*
*/
class drush::install {

package { "drush":
ensure => "4.5-6",
}

}
9 changes: 7 additions & 2 deletions modules/git/manifests/init.pp
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@

/**
*
* Nothing special, just a basic version of git
*
*/
class git {

package { "git-core":
ensure => "1:1.7.9.5-1",
}

}
8 changes: 7 additions & 1 deletion modules/mysql/manifests/init.pp
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@

/**
*
* Installs and configures the mysql-server
*
*/
class mysql {

include mysql::server

}
9 changes: 8 additions & 1 deletion modules/mysql/manifests/my.pp
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@

/**
*
* Defines and sets default values for a my.cnf file
*
*/
define mysql::my (

# basic settings
$path = "/etc/mysql/my.cnf",
$port = 3306,
Expand Down Expand Up @@ -33,11 +38,13 @@
$isort_buffer_size = "256M",
$iread_buffer = "2M",
$iwrite_buffer = "2M",

) {

file {
"${path}":
path => "${path}",
content => template("mysql/my.cnf.erb"),
}

}
8 changes: 7 additions & 1 deletion modules/mysql/manifests/server.pp
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@

/**
*
* Loads subclasses to complete the server install and config
*
*/
class mysql::server {

include mysql::server::install, mysql::server::config, mysql::server::service

}
6 changes: 5 additions & 1 deletion modules/mysql/manifests/server/config.pp
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@

/**
*
* Class that governs the creation of the mysql-server configuration
*
*/
class mysql::server::config {

mysql::my { "my.cnf":
Expand Down
9 changes: 8 additions & 1 deletion modules/mysql/manifests/server/db.pp
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@

/**
*
* Basic definition to create a database
*
*/
define mysql::server::db($username, $password, $host = 'localhost') {

$root_password = $mysql::server::install::password

exec { "create-${name}-db":
unless => "/usr/bin/mysql -u${username} -p${password} ${name}",
command => "/usr/bin/mysql -uroot -p${root_password} -e \"create database ${name}; grant all on ${name}.* to ${username}@${host} identified by '$password';\"",
require => Class['mysql::server::service'],
}

}
15 changes: 13 additions & 2 deletions modules/mysql/manifests/server/install.pp
Original file line number Diff line number Diff line change
@@ -1,13 +1,25 @@

/**
*
* Sets up mysql-server by:
*
* 1. Installs the mysql-server package
* 2. Installs the php5 mysql extension
* 3. Adds the mysql root user and sets it's password
*
*/
class mysql::server::install {

$password = "password"

# Install mysql-server
package { "mysql-server":
ensure => "5.5.24-0ubuntu0.12.04.1"
}

# Install php5 extension
phpfpm::extension { "php5-mysql": version => "5.3.10-1ubuntu3.4", }

# Add the root user
exec { "Set MySQL server root password":
subscribe => Package["mysql-server"],
refreshonly => true,
Expand All @@ -16,5 +28,4 @@
command => "mysqladmin -uroot password $password",
}


}
8 changes: 7 additions & 1 deletion modules/mysql/manifests/server/service.pp
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@

/**
*
* Makes sure the mysql service is running
*
*/
class mysql::server::service {

service { "mysql-server":
ensure => running,
name => "mysql",
Expand All @@ -8,4 +13,5 @@
enable => true,
require => Class["mysql::server::install"],
}

}
9 changes: 7 additions & 2 deletions modules/network/manifests/config.pp
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@

/**
*
* Provides a basic hosts file
*
*/
class network::config {
file { "/etc/hosts" :
ensure => present,
content => template("network/hosts.erb"),
owner => "root",
group => "root",
}

}
8 changes: 7 additions & 1 deletion modules/network/manifests/init.pp
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@

/**
*
* All classes regarding networking go here
*
*/
class network {

include network::config

}
10 changes: 7 additions & 3 deletions modules/nginx/manifests/init.pp
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@

/**
*
* Installs and configures nginx
*
*/
class nginx {

include nginx::install, nginx::service

}
8 changes: 6 additions & 2 deletions modules/nginx/manifests/install.pp
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@

/**
*
* Installst the nginx package
*
*/
class nginx::install {
package { "nginx":
ensure => "1.1.19-1",
}
Expand Down
6 changes: 5 additions & 1 deletion modules/nginx/manifests/service.pp
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@

/**
*
* Makes sure nginx is running
*
*/
class nginx::service ($ensure = "running") {

service { "nginx":
Expand Down
9 changes: 8 additions & 1 deletion modules/nginx/manifests/vhost.pp
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@

/**
*
* Basic definition for a barebones nginx vhost
*
*/
define nginx::vhost (

$vhost = $title,
$root = "/var/www",
$server_name = "_",

) {

file { "/etc/nginx/sites-available/${vhost}":
Expand All @@ -19,4 +25,5 @@
target => "/etc/nginx/sites-available/${vhost}",
require => Class["nginx::install"],
}

}
6 changes: 5 additions & 1 deletion modules/php5/manifests/config.pp
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@

/**
*
* Builds a basic php.ini file for CLI
*
*/
class php5::config {

php5::ini { "cli":
Expand Down
9 changes: 8 additions & 1 deletion modules/php5/manifests/ini.pp
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@

/**
*
* Definition for building a php.ini file
*
*/
define php5::ini (

$path = "/etc/php.ini",
$disable_functions = "pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,",
$max_execution_time = 30,
Expand All @@ -12,11 +17,13 @@
$error_log = "/var/log/php_errors.l#og",
$post_max_size = "200M",
$upload_max_filesize = "200M",

) {

file {
"${path}":
path => "${path}",
content => template("php5/php.ini.erb"),
}

}
6 changes: 5 additions & 1 deletion modules/php5/manifests/init.pp
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@

/**
*
* Install and sets up PHP5 for CLI
*
*/
class php5 {

include php5::install, php5::config
Expand Down
6 changes: 5 additions & 1 deletion modules/php5/manifests/install.pp
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@

/**
*
* Installs PHP5 for CLI
*
*/
class php5::install {

package { "php5-cli":
Expand Down
Loading

0 comments on commit 6eb456b

Please sign in to comment.