provizioning 0.1.2 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/README.md +29 -0
- data/Rakefile +2 -0
- data/bootstrap/bootstrap.sh +71 -0
- data/{lib/templates/sources.list → bootstrap/lucid.sources.list} +2 -1
- data/bootstrap/natty.sources.list +14 -0
- data/lib/provizioning/puppet.rb +94 -0
- data/lib/provizioning/version.rb +3 -0
- data/lib/provizioning.rb +1 -3
- data/provizioning.gemspec +20 -0
- data/puppet/classes/apache/centos.conf +978 -0
- data/puppet/classes/apache/ssl.conf +75 -0
- data/puppet/classes/apache.pp +152 -0
- data/puppet/classes/apt.pp +5 -0
- data/puppet/classes/base/ntp/ntpd-sysconfig +13 -0
- data/puppet/classes/base.pp +79 -0
- data/puppet/classes/freerange.pp +53 -0
- data/puppet/classes/gemrc/gemrc +9 -0
- data/puppet/classes/gemrc.pp +10 -0
- data/puppet/classes/imagemagick.pp +19 -0
- data/puppet/classes/iptables/load-iptables +3 -0
- data/puppet/classes/iptables/post-iptables +2 -0
- data/puppet/classes/iptables/pre-iptables +2 -0
- data/puppet/classes/iptables.pp +59 -0
- data/puppet/classes/logrotate/logrotate.erb +15 -0
- data/puppet/classes/logrotate.pp +37 -0
- data/puppet/classes/mongo/mongodb.conf +89 -0
- data/puppet/classes/mongo.pp +86 -0
- data/puppet/classes/monit/monit.conf +242 -0
- data/puppet/classes/monit.pp +39 -0
- data/puppet/classes/munin/plugins/passenger_memory_stats +123 -0
- data/puppet/classes/munin/plugins/passenger_status +130 -0
- data/puppet/classes/munin/plugins/rails_database_time +174 -0
- data/puppet/classes/munin/plugins/rails_request_duration +173 -0
- data/puppet/classes/munin/plugins/rails_request_error +169 -0
- data/puppet/classes/munin/plugins/rails_requests +175 -0
- data/puppet/classes/munin/plugins/rails_view_render_time +173 -0
- data/puppet/classes/munin/rails-plugin-config +4 -0
- data/puppet/classes/munin.pp +60 -0
- data/puppet/classes/mysql/password.erb +1 -0
- data/puppet/classes/mysql.pp +71 -0
- data/puppet/classes/openswan/ipsec.conf +17 -0
- data/puppet/classes/openswan/ipsec.secrets +1 -0
- data/puppet/classes/openswan/patched_ipsec_initd_script +223 -0
- data/puppet/classes/openswan/secret.erb +1 -0
- data/puppet/classes/openswan.pp +71 -0
- data/puppet/classes/post-flight.pp +17 -0
- data/puppet/classes/postfix/main.cf +39 -0
- data/puppet/classes/postfix.pp +16 -0
- data/puppet/classes/rack/centos/passenger.load.erb +5 -0
- data/puppet/classes/rack/ubuntu/passenger.conf.erb +6 -0
- data/puppet/classes/rack.pp +66 -0
- data/puppet/classes/redis/redis.conf.erb +187 -0
- data/puppet/classes/redis.pp +20 -0
- data/puppet/classes/sudo/sudoers +6 -0
- data/puppet/classes/sudo.pp +24 -0
- data/puppet/classes/syslogng/CentOS.cnf +61 -0
- data/puppet/classes/syslogng/Ubuntu.cnf +347 -0
- data/puppet/classes/syslogng.pp +146 -0
- data/puppet/classes/xml.pp +23 -0
- data/puppet/classes/yum.pp +6 -0
- data/puppet/classes/zsh.pp +5 -0
- data/puppet/modules/README +74 -0
- data/puppet/modules/cron/README +4 -0
- data/puppet/modules/cron/manifests/base.pp +26 -0
- data/puppet/modules/cron/manifests/crontabs.pp +11 -0
- data/puppet/modules/cron/manifests/init.pp +18 -0
- data/puppet/modules/drupal/Modulefile +7 -0
- data/puppet/modules/drupal/README +110 -0
- data/puppet/modules/drupal/manifests/absent.pp +25 -0
- data/puppet/modules/drupal/manifests/backup/absent.pp +23 -0
- data/puppet/modules/drupal/manifests/backup.pp +49 -0
- data/puppet/modules/drupal/manifests/conf.pp +23 -0
- data/puppet/modules/drupal/manifests/debug.pp +26 -0
- data/puppet/modules/drupal/manifests/disable.pp +22 -0
- data/puppet/modules/drupal/manifests/disableboot.pp +13 -0
- data/puppet/modules/drupal/manifests/drush.pp +20 -0
- data/puppet/modules/drupal/manifests/example42/backup.pp +8 -0
- data/puppet/modules/drupal/manifests/example42/monitor.pp +8 -0
- data/puppet/modules/drupal/manifests/example42.pp +25 -0
- data/puppet/modules/drupal/manifests/extra.pp +30 -0
- data/puppet/modules/drupal/manifests/firewall/absent.pp +19 -0
- data/puppet/modules/drupal/manifests/firewall.pp +24 -0
- data/puppet/modules/drupal/manifests/init.pp +54 -0
- data/puppet/modules/drupal/manifests/install.pp +20 -0
- data/puppet/modules/drupal/manifests/module.pp +37 -0
- data/puppet/modules/drupal/manifests/monitor/absent.pp +42 -0
- data/puppet/modules/drupal/manifests/monitor.pp +77 -0
- data/puppet/modules/drupal/manifests/package.pp +20 -0
- data/puppet/modules/drupal/manifests/params.pp +277 -0
- data/puppet/modules/drupal/manifests/site.pp +63 -0
- data/puppet/modules/drupal/manifests/theme.pp +33 -0
- data/puppet/modules/drupal/templates/variables_drupal.erb +62 -0
- data/puppet/modules/drupal/tests/absent.pp +1 -0
- data/puppet/modules/drupal/tests/backup.pp +1 -0
- data/puppet/modules/drupal/tests/debug.pp +1 -0
- data/puppet/modules/drupal/tests/disable.pp +1 -0
- data/puppet/modules/drupal/tests/disableboot.pp +1 -0
- data/puppet/modules/drupal/tests/firewall.pp +1 -0
- data/puppet/modules/drupal/tests/init.pp +1 -0
- data/puppet/modules/drupal/tests/monitor.pp +1 -0
- data/puppet/modules/hosts/README +0 -0
- data/puppet/modules/hosts/manifests/example42.pp +5 -0
- data/puppet/modules/hosts/manifests/init.pp +16 -0
- data/puppet/modules/hosts/templates/hosts.erb +11 -0
- data/puppet/modules/iptables/README +4 -0
- data/puppet/modules/iptables/files/iptables +19 -0
- data/puppet/modules/iptables/manifests/disable.pp +15 -0
- data/puppet/modules/iptables/manifests/init.pp +9 -0
- data/puppet/modules/iptables/manifests/redhat.pp +24 -0
- data/puppet/modules/mysql/Modulefile +7 -0
- data/puppet/modules/mysql/README +56 -0
- data/puppet/modules/mysql/manifests/absent.pp +12 -0
- data/puppet/modules/mysql/manifests/backup/example42.pp +8 -0
- data/puppet/modules/mysql/manifests/backup.pp +49 -0
- data/puppet/modules/mysql/manifests/client.pp +18 -0
- data/puppet/modules/mysql/manifests/conf.pp +23 -0
- data/puppet/modules/mysql/manifests/debug.pp +25 -0
- data/puppet/modules/mysql/manifests/disable.pp +13 -0
- data/puppet/modules/mysql/manifests/disableboot.pp +13 -0
- data/puppet/modules/mysql/manifests/example42.pp +25 -0
- data/puppet/modules/mysql/manifests/firewall.pp +23 -0
- data/puppet/modules/mysql/manifests/grant.pp +29 -0
- data/puppet/modules/mysql/manifests/init.pp +67 -0
- data/puppet/modules/mysql/manifests/monitor/example42.pp +8 -0
- data/puppet/modules/mysql/manifests/monitor.pp +77 -0
- data/puppet/modules/mysql/manifests/params.pp +240 -0
- data/puppet/modules/mysql/manifests/query.pp +30 -0
- data/puppet/modules/mysql/templates/grant.erb +6 -0
- data/puppet/modules/mysql/templates/query.erb +5 -0
- data/puppet/modules/mysql/templates/variables_mysql.erb +42 -0
- data/puppet/modules/network/README +4 -0
- data/puppet/modules/network/manifests/init.pp +13 -0
- data/puppet/modules/nginx/manifests/fcgi.pp +87 -0
- data/puppet/modules/nginx/manifests/init.pp +205 -0
- data/puppet/modules/nginx/templates/fcgi_site.erb +38 -0
- data/puppet/modules/nginx/templates/includes/fastcgi_params.erb +23 -0
- data/puppet/modules/nginx/templates/nginx.conf.erb +31 -0
- data/puppet/modules/passenger/manifests/init.pp +12 -0
- data/puppet/modules/passenger/templates/myapp +39 -0
- data/puppet/modules/php/README +26 -0
- data/puppet/modules/php/manifests/init.pp +42 -0
- data/puppet/modules/php/manifests/module.pp +22 -0
- data/puppet/modules/php/manifests/pear/module.pp +21 -0
- data/puppet/modules/php/manifests/pear.pp +20 -0
- data/puppet/modules/php/manifests/pecl/config.pp +19 -0
- data/puppet/modules/php/manifests/pecl/module.pp +44 -0
- data/puppet/modules/php/manifests/pecl.pp +8 -0
- data/puppet/modules/php/manifests/soap.pp +20 -0
- data/puppet/modules/postgres/Copyright +13 -0
- data/puppet/modules/postgres/manifests/database.pp +40 -0
- data/puppet/modules/postgres/manifests/init.pp +25 -0
- data/puppet/modules/postgres/manifests/role.pp +40 -0
- data/puppet/modules/ruby/files/install-ruby-stow +43 -0
- data/puppet/modules/ruby/manifests/init.pp +18 -0
- data/puppet/modules/rvm/files/install-system-rvm +2 -0
- data/puppet/modules/rvm/manifests/classes/dependencies.pp +24 -0
- data/puppet/modules/rvm/manifests/classes/passenger.pp +166 -0
- data/puppet/modules/rvm/manifests/classes/system.pp +33 -0
- data/puppet/modules/rvm/manifests/definitions/system_user.pp +13 -0
- data/puppet/modules/rvm/manifests/init.pp +2 -0
- data/puppet/modules/rvm/templates/passenger-apache.conf.erb +9 -0
- data/puppet/modules/ssh/README +4 -0
- data/puppet/modules/ssh/manifests/auth.pp +39 -0
- data/puppet/modules/ssh/manifests/auth.pp.good +340 -0
- data/puppet/modules/ssh/manifests/eal4.pp +69 -0
- data/puppet/modules/ssh/manifests/init.pp +74 -0
- data/puppet/modules/stow/manifests/init.pp +5 -0
- data/puppet/modules/sudo/files/sudoers +25 -0
- data/puppet/modules/sudo/manifests/init.pp +1 -0
- data/puppet/modules/sudo/manifests/install.pp +5 -0
- data/puppet/modules/sudo/manifests/sudoers.pp +14 -0
- data/puppet/modules/ufw/manifests/init.pp +12 -0
- data/puppet/modules/users/README +28 -0
- data/puppet/modules/users/manifests/adduser.pp +16 -0
- data/puppet/modules/users/manifests/admin.pp +11 -0
- data/puppet/modules/users/manifests/automount.pp +34 -0
- data/puppet/modules/users/manifests/deluser.pp +8 -0
- data/puppet/modules/users/manifests/example42.pp +16 -0
- data/puppet/modules/users/manifests/init.pp +31 -0
- data/puppet/modules/users/manifests/ldap.pp +114 -0
- data/puppet/modules/users/manifests/params.pp +84 -0
- data/puppet/modules/users/templates/ldap/ldap.conf.erb +13 -0
- data/puppet/modules/users/templates/ldap/nsswitch.conf.erb +23 -0
- data/puppet/modules/users/templates/ldap/openldap-ldap.conf.erb +8 -0
- data/puppet/modules/webmin/manifests/init.pp +31 -0
- data/puppet/roles/blank.pp +1 -0
- data/puppet/site.pp +8 -0
- metadata +235 -81
- data/README +0 -3
- data/bin/provizion +0 -52
- data/lib/policies/chef-client.rb +0 -37
- data/lib/policies/lamp.rb +0 -42
- data/lib/policies/passenger.rb +0 -44
- data/lib/recipes/apache.rb +0 -70
- data/lib/recipes/apache_conf.rb +0 -3
- data/lib/recipes/bundler.rb +0 -4
- data/lib/recipes/chef_client.rb +0 -11
- data/lib/recipes/curl.rb +0 -8
- data/lib/recipes/essential.rb +0 -4
- data/lib/recipes/git.rb +0 -15
- data/lib/recipes/imagemagick.rb +0 -8
- data/lib/recipes/mailserver.rb +0 -9
- data/lib/recipes/memcached.rb +0 -16
- data/lib/recipes/mysql.rb +0 -21
- data/lib/recipes/nginx/init.d +0 -63
- data/lib/recipes/nginx.rb +0 -25
- data/lib/recipes/passenger.rb +0 -67
- data/lib/recipes/php.rb +0 -8
- data/lib/recipes/postgresql.rb +0 -21
- data/lib/recipes/ruby_enterprise.rb +0 -24
- data/lib/recipes/rvm.rb +0 -25
- data/lib/recipes/sources.rb +0 -5
- data/lib/recipes/subversion.rb +0 -8
- data/lib/recipes/syslog.rb +0 -7
- data/lib/recipes/ufw.rb +0 -12
- data/lib/recipes/vim.rb +0 -8
- data/lib/recipes/webmin.rb +0 -17
- data/lib/templates/apache.conf.erb +0 -12
- data/lib/templates/my.cnf +0 -132
- data/lib/templates/passenger.conf +0 -11
- data/lib/templates/passenger.load +0 -1
@@ -0,0 +1,24 @@
|
|
1
|
+
class iptables::redhat {
|
2
|
+
|
3
|
+
service { iptables:
|
4
|
+
name => $operatingsystem ? {
|
5
|
+
default => "iptables",
|
6
|
+
},
|
7
|
+
ensure => running,
|
8
|
+
enable => true,
|
9
|
+
hasrestart => false,
|
10
|
+
restart => "iptables-restore < /etc/sysconfig/iptables",
|
11
|
+
hasstatus => true,
|
12
|
+
# Uncomment to automate iptables restart on config change (Careful!!)
|
13
|
+
# subscribe File["iptables"],
|
14
|
+
}
|
15
|
+
|
16
|
+
file {
|
17
|
+
"iptables":
|
18
|
+
ensure => present,
|
19
|
+
path => $operatingsystem ?{
|
20
|
+
default => "/etc/sysconfig/iptables",
|
21
|
+
},
|
22
|
+
}
|
23
|
+
|
24
|
+
}
|
@@ -0,0 +1,56 @@
|
|
1
|
+
Puppet module: mysql
|
2
|
+
|
3
|
+
# Written by Lab42 #
|
4
|
+
# http://www.Example42.com
|
5
|
+
|
6
|
+
Licence: GPLv3
|
7
|
+
|
8
|
+
DESCRIPTION:
|
9
|
+
This module installs and manages mysql.
|
10
|
+
Standard and extended classes are available.
|
11
|
+
Decide and customize how you want to define configuration files: static files, templates, infile modifications...
|
12
|
+
|
13
|
+
|
14
|
+
USER VARIABLES:
|
15
|
+
|
16
|
+
|
17
|
+
USAGE:
|
18
|
+
# Standard Classes
|
19
|
+
include mysql # Install and run mysql
|
20
|
+
|
21
|
+
include mysql::disable # Disable mysql service.
|
22
|
+
include mysql::disableboot # Disable mysql service at boot time, but don't stop if it's running.
|
23
|
+
include mysql::absent # Remove mysql package.
|
24
|
+
|
25
|
+
# Extended Classes (generally require storeconfigs)
|
26
|
+
include mysql::monitor # Monitor mysql - Automatically included if $monitor=yes - Requires Example42's monitor module
|
27
|
+
include mysql::backup # Backup mysql data - Automatically included if $backup=yes - Requires Example42's backup module
|
28
|
+
include mysql::firewall # Manages firewall rule for mysql service - Automatically included if $firewall=yes - Requires Example42's firewall module
|
29
|
+
|
30
|
+
# Generic define to set parameters in the main configuration file. EXPERIMENTAL.
|
31
|
+
mysql::conf { "ParameterName": value="YourValue"} # Generic
|
32
|
+
|
33
|
+
# Module specific classes
|
34
|
+
|
35
|
+
# Module specific defines
|
36
|
+
mysql::grant # Grant permissions
|
37
|
+
mysql::query # Runs arbitrary queries
|
38
|
+
|
39
|
+
GENERAL VARIABLES:
|
40
|
+
Example42 modules collection uses some general variables that can influence the behaviour of this module.
|
41
|
+
You can happily live without considering or setting them, but they can be useful to manage different projects maintanining the module's resuability.
|
42
|
+
$my_project - If set, permits you to alter and customize the module behaviour in custom project classes
|
43
|
+
$my_project_onmodule - If set to yes your project classes are looked in a dedicated project module:
|
44
|
+
- $my_project_onmodule not set -> Module autoloads mysql::$my_module (MODULEPATH/mysql/manifests/$my_project.pp)
|
45
|
+
- $my_project_onmodule == yes -> Module autoloads $my_module::mysql (MODULEPATH/$my_project/manifests/mysql.pp)
|
46
|
+
$base_source - Let you define an alternative source for static files:
|
47
|
+
- $base_source not set -> Files are looked in puppet://$servername/ (the PuppetMaster)
|
48
|
+
- $base_source set -> Files are looked in $base_source ( could be puppet://$servername/$my_module )
|
49
|
+
Note that the module automatically manages the different paths for Puppet pre 0.25
|
50
|
+
|
51
|
+
|
52
|
+
DEPENDENCIES:
|
53
|
+
Standard classes generally don't need external modules.
|
54
|
+
Extended classes need the relevant external modules (import monitor ; import backup ... ) and the "common" module (import common)
|
55
|
+
mysql::conf generic infile configuration define needs the "common" module
|
56
|
+
Check on individual module specific classes and defines if there are specific requirements.
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# Class: mysql::backup
|
2
|
+
#
|
3
|
+
# Backups mysql data and logs using Example42 backup meta module (to be adapted to custom backup solutions)
|
4
|
+
# It's automatically included and used if $backup=yes
|
5
|
+
# This class permits to abstract what you want to backup from the tool and module to use for backups.
|
6
|
+
#
|
7
|
+
# Variables:
|
8
|
+
# The behaviour of this class has some defaults that can be overriden by user's variables:
|
9
|
+
# $mysql_backup_data (true|false) : Set if you want to backup mysql's data. Default: As defined in $backup_data
|
10
|
+
# $mysql_backup_log (true|false) : Set if you want to backup mysql's logs. Default: As defined in $backup_log
|
11
|
+
# $mysql_backup_frequency (hourly|daily|weekly|monthly) : Set the frequency of your mysql backups. Default: daily.
|
12
|
+
# $mysql_backup_target : Define how to reach (Ip, fqdn...) this host to backup mysql from an external server. Default: As defined in $backup_target
|
13
|
+
#
|
14
|
+
# You can also set some site wide variables that can be overriden by the above module specific ones:
|
15
|
+
# $backup_data (true|false) : Set if you want to enable data backups site-wide.
|
16
|
+
# $backup_log (true|false) : Set if you want to enable logs backups site-wide.
|
17
|
+
# $backup_target : Set the ip/hostname you want to use on an external backup server to backup this host
|
18
|
+
# For the defaults of the above variables check mysql::params
|
19
|
+
#
|
20
|
+
# Usage:
|
21
|
+
# Automatically included if $backup=yes
|
22
|
+
#
|
23
|
+
class mysql::backup {
|
24
|
+
|
25
|
+
include mysql::params
|
26
|
+
|
27
|
+
backup { "mysql_data":
|
28
|
+
frequency => "${mysql::params::backup_frequency}",
|
29
|
+
path => "${mysql::params::datadir}",
|
30
|
+
enabled => "${mysql::params::backup_data_enable}",
|
31
|
+
target => "${mysql::params::backup_target_real}",
|
32
|
+
}
|
33
|
+
|
34
|
+
backup { "mysql_logs":
|
35
|
+
frequency => "${mysql::params::backup_frequency}",
|
36
|
+
path => "${mysql::params::logdir}",
|
37
|
+
enabled => "${mysql::params::backup_log_enable}",
|
38
|
+
target => "${mysql::params::backup_target_real}",
|
39
|
+
}
|
40
|
+
|
41
|
+
# Include project specific backup class if $my_project is set
|
42
|
+
if $my_project {
|
43
|
+
case $my_project_onmodule {
|
44
|
+
yes,true: { include "${my_project}::mysql::backup" }
|
45
|
+
default: { include "mysql::backup::${my_project}" }
|
46
|
+
}
|
47
|
+
}
|
48
|
+
|
49
|
+
}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# Class: mysql::client
|
2
|
+
#
|
3
|
+
# Manages mysql client installation
|
4
|
+
#
|
5
|
+
# Usage:
|
6
|
+
# include mysql::client
|
7
|
+
#
|
8
|
+
class mysql::client {
|
9
|
+
|
10
|
+
include mysql::params
|
11
|
+
|
12
|
+
package { "mysql-client":
|
13
|
+
name => "${mysql::params::packagename_client}",
|
14
|
+
ensure => present,
|
15
|
+
}
|
16
|
+
|
17
|
+
}
|
18
|
+
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# Define mysql::conf
|
2
|
+
#
|
3
|
+
# General mysql main configuration file's inline modification define
|
4
|
+
# Use with caution, it's still at experimental stage and may break in untested circumstances
|
5
|
+
# Engine, pattern end line parameters can be tweaked for better behaviour
|
6
|
+
#
|
7
|
+
# Usage:
|
8
|
+
# mysql::conf { "mynetworks": value => "127.0.0.0/8 10.42.42.0/24" }
|
9
|
+
#
|
10
|
+
define mysql::conf ($value) {
|
11
|
+
|
12
|
+
require mysql::params
|
13
|
+
|
14
|
+
config { "mysql_conf_$name":
|
15
|
+
file => "${mysql::params::configfile}",
|
16
|
+
line => "$name = $value",
|
17
|
+
pattern => "^$name ",
|
18
|
+
engine => "replaceline",
|
19
|
+
notify => Service["mysql"],
|
20
|
+
require => File["mysql.conf"],
|
21
|
+
}
|
22
|
+
|
23
|
+
}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
#
|
2
|
+
# Class: mysql::debug
|
3
|
+
#
|
4
|
+
# This class is used only for debugging purposes
|
5
|
+
#
|
6
|
+
# Usage:
|
7
|
+
# This class is used if you set $debug=yes
|
8
|
+
#
|
9
|
+
class mysql::debug {
|
10
|
+
|
11
|
+
# Load the variables used in this module. Check the params.pp file
|
12
|
+
require mysql::params
|
13
|
+
include puppet::params
|
14
|
+
|
15
|
+
file { "puppet_debug_variables_mysql":
|
16
|
+
path => "${puppet::params::debugdir}/variables/mysql",
|
17
|
+
mode => "${mysql::params::configfile_mode}",
|
18
|
+
owner => "${mysql::params::configfile_owner}",
|
19
|
+
group => "${mysql::params::configfile_group}",
|
20
|
+
ensure => present,
|
21
|
+
require => File["puppet_debug_variables"],
|
22
|
+
content => template("mysql/variables_mysql.erb"),
|
23
|
+
}
|
24
|
+
|
25
|
+
}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# Class: mysql::disableboot
|
2
|
+
#
|
3
|
+
# This class disables mysql startup at boot time but doesn't check if the service is running
|
4
|
+
# Useful when the service is started but another applications (such as a Cluster suite)
|
5
|
+
#
|
6
|
+
# Usage:
|
7
|
+
# include mysql::disableboot
|
8
|
+
#
|
9
|
+
class mysql::disableboot inherits mysql {
|
10
|
+
Service["mysql"] {
|
11
|
+
enable => "false",
|
12
|
+
}
|
13
|
+
}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# Class mysql::example42
|
2
|
+
#
|
3
|
+
# Custom project class for example42 project. Use this to adapt the mysql module to your project.
|
4
|
+
# This class is autoloaded if $my_module == example42 and $my_module_onmodule != yes
|
5
|
+
# If $my_module_onmodule == yes Puppet tries to autoload example42::mysql
|
6
|
+
# that is: MODULEPATH/example42/manifests/mysql.pp
|
7
|
+
#
|
8
|
+
# You can use your custom project class to modify the standard behaviour of mysql module
|
9
|
+
# If you need to override parameters of resources defined in mysql class use a syntax like
|
10
|
+
# class mysql::example42 inherits mysql {
|
11
|
+
# File["mysql.conf"] {
|
12
|
+
# source => [ "puppet:///mysql/mysql.conf-$hostname" , "puppet:///mysql/mysql.conf" ],
|
13
|
+
# }
|
14
|
+
#
|
15
|
+
# You don't need to use class inheritance if you don't override or redefine resources in mysql class
|
16
|
+
#
|
17
|
+
# Note that this approach leaves you maximum flexinility on how to manage mysql application in your environment
|
18
|
+
# You can add custom resources and decide how to provide the contents of the configuration files:
|
19
|
+
# - Via static sourced files ( source => ) according to the naming convention you need
|
20
|
+
# - Via custom templates ( content => ) or templates joins
|
21
|
+
# - Via some kind on infile line modification tools, such as Augeas or the Example42's conf define approach
|
22
|
+
#
|
23
|
+
class mysql::example42 {
|
24
|
+
|
25
|
+
}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# Class: mysql::firewall
|
2
|
+
#
|
3
|
+
# Manages mysql firewalling using custom Firewall wrapper
|
4
|
+
# By default it opens mysql's default port(s) to anybody
|
5
|
+
# It's automatically included if $firewall=yes
|
6
|
+
#
|
7
|
+
# Usage:
|
8
|
+
# Automatically included if $firewall=yes
|
9
|
+
#
|
10
|
+
class mysql::firewall {
|
11
|
+
|
12
|
+
include mysql::params
|
13
|
+
|
14
|
+
firewall { "mysql_${mysql::params::protocol}_${mysql::params::port}":
|
15
|
+
source => "${mysql::params::firewall_source_real}",
|
16
|
+
destination => "${mysql::params::firewall_destination_real}",
|
17
|
+
protocol => "${mysql::params::protocol}",
|
18
|
+
port => "${mysql::params::port}",
|
19
|
+
action => "allow",
|
20
|
+
direction => "input",
|
21
|
+
}
|
22
|
+
|
23
|
+
}
|
@@ -0,0 +1,29 @@
|
|
1
|
+
define mysql::grant (
|
2
|
+
$mysql_db,
|
3
|
+
$mysql_user,
|
4
|
+
$mysql_password,
|
5
|
+
$mysql_privileges = "ALL",
|
6
|
+
$mysql_host = "localhost",
|
7
|
+
$mysql_grant_filepath = "/root"
|
8
|
+
) {
|
9
|
+
|
10
|
+
include mysql
|
11
|
+
|
12
|
+
file {
|
13
|
+
"mysqlgrant-$mysql_user-$mysql_db.sql":
|
14
|
+
mode => 600, owner => root, group => root,
|
15
|
+
ensure => present,
|
16
|
+
path => "$mysql_grant_filepath/mysqlgrant-$mysql_user-$mysql_db.sql",
|
17
|
+
content => template("mysql/grant.erb"),
|
18
|
+
notify => Exec["mysqlgrant-$mysql_user-$mysql_db"],
|
19
|
+
}
|
20
|
+
|
21
|
+
exec {
|
22
|
+
"mysqlgrant-$mysql_user-$mysql_db":
|
23
|
+
command => "mysql < $mysql_grant_filepath/mysqlgrant-$mysql_user-$mysql_db.sql",
|
24
|
+
require => Service["mysql"],
|
25
|
+
unless => "mysql --user=$mysql_user --password=$mysql_password $mysql_db",
|
26
|
+
}
|
27
|
+
|
28
|
+
}
|
29
|
+
|
@@ -0,0 +1,67 @@
|
|
1
|
+
#
|
2
|
+
# Class: mysql
|
3
|
+
#
|
4
|
+
# Manages mysql.
|
5
|
+
# Include it to install and run mysql
|
6
|
+
# It defines package, service, main configuration file.
|
7
|
+
#
|
8
|
+
# Usage:
|
9
|
+
# include mysql
|
10
|
+
#
|
11
|
+
class mysql {
|
12
|
+
|
13
|
+
# Load the variables used in this module. Check the params.pp file
|
14
|
+
require mysql::params
|
15
|
+
|
16
|
+
# Basic Package - Service - Configuration file management
|
17
|
+
package { "mysql":
|
18
|
+
name => "${mysql::params::packagename}",
|
19
|
+
ensure => present,
|
20
|
+
}
|
21
|
+
|
22
|
+
service { "mysql":
|
23
|
+
name => "${mysql::params::servicename}",
|
24
|
+
ensure => running,
|
25
|
+
enable => true,
|
26
|
+
hasrestart => true,
|
27
|
+
hasstatus => "${mysql::params::hasstatus}",
|
28
|
+
pattern => "${mysql::params::processname}",
|
29
|
+
require => Package["mysql"],
|
30
|
+
subscribe => File["mysql.conf"],
|
31
|
+
}
|
32
|
+
|
33
|
+
file { "mysql.conf":
|
34
|
+
path => "${mysql::params::configfile}",
|
35
|
+
mode => "${mysql::params::configfile_mode}",
|
36
|
+
owner => "${mysql::params::configfile_owner}",
|
37
|
+
group => "${mysql::params::configfile_group}",
|
38
|
+
ensure => present,
|
39
|
+
require => Package["mysql"],
|
40
|
+
notify => Service["mysql"],
|
41
|
+
# content => template("mysql/mysql.conf.erb"),
|
42
|
+
}
|
43
|
+
|
44
|
+
# Include OS specific subclasses, if necessary
|
45
|
+
case $operatingsystem {
|
46
|
+
default: { }
|
47
|
+
}
|
48
|
+
|
49
|
+
# Include extended classes, if
|
50
|
+
if $backup == "yes" { include mysql::backup }
|
51
|
+
if $monitor == "yes" { include mysql::monitor }
|
52
|
+
if $firewall == "yes" { include mysql::firewall }
|
53
|
+
|
54
|
+
# Include project specific class if $my_project is set
|
55
|
+
# The extra project class is by default looked in mysql module
|
56
|
+
# If $my_project_onmodule == yes it's looked in your project module
|
57
|
+
if $my_project {
|
58
|
+
case $my_project_onmodule {
|
59
|
+
yes,true: { include "${my_project}::mysql" }
|
60
|
+
default: { include "mysql::${my_project}" }
|
61
|
+
}
|
62
|
+
}
|
63
|
+
|
64
|
+
# Include debug class is debugging is enabled ($debug=yes)
|
65
|
+
if ( $debug == "yes" ) or ( $debug == true ) { include mysql::debug }
|
66
|
+
|
67
|
+
}
|
@@ -0,0 +1,77 @@
|
|
1
|
+
# Class: mysql::monitor
|
2
|
+
#
|
3
|
+
# Monitors mysql process/ports/service using Example42 monitor meta module (to be adapted to custom monitor solutions)
|
4
|
+
# It's automatically included ad used if $monitor=yes and is defined at least one monitoring software in $monitor_tool
|
5
|
+
# This class permits to abstract what you want to monitor from the actual tool and modules you'll use for monitoring
|
6
|
+
# and can be used to quickly deploy a new monitoring solution
|
7
|
+
#
|
8
|
+
# Variables:
|
9
|
+
# The behaviour of this class has some defaults that can be overriden by user's variables:
|
10
|
+
# $mysql_monitor_port (true|false) : Set if you want to monitor mysql's port(s). If any. Default: As defined in $monitor_port
|
11
|
+
# $mysql_monitor_url (true|false) : Set if you want to monitor mysql's url(s). If any. Default: As defined in $monitor_url
|
12
|
+
# $mysql_monitor_process (true|false) : Set if you want to monitor mysql's process. If any. Default: As defined in $monitor_process
|
13
|
+
# $mysql_monitor_plugin (true|false) : Set if you want to monitor mysql using specific monitor tool's plugin i s. If any. Default: As defined in $monitor_plugin
|
14
|
+
# $mysql_monitor_target : Define how to reach (Ip, fqdn...) the host to monitor mysql from an external server. Default: As defined in $monitor_target
|
15
|
+
# $mysql_monitor_url : Define the baseurl (http://$fqdn/...) to use for eventual mysql URL checks. Default: As defined in $monitor_url
|
16
|
+
#
|
17
|
+
# You can therefore set site wide variables that can be overriden by the above module specific ones:
|
18
|
+
# $monitor_port (true|false) : Set if you want to enable port monitoring site-wide.
|
19
|
+
# $monitor_url (true|false) : Set if you want to enable url checking site-wide.
|
20
|
+
# $monitor_process (true|false) : Set if you want to enable process monitoring site-wide.
|
21
|
+
# $monitor_plugin (true|false) : Set if you want to try to use specific plugins of your monitoring tools
|
22
|
+
# $monitor_target : Set the ip/hostname you want to use on an external monitoring server to monitor this host
|
23
|
+
# $monitor_baseurl : Set baseurl to use for eventual URL checks of services provided by this host
|
24
|
+
# For the defaults of the above variables check mysql::params
|
25
|
+
#
|
26
|
+
# Usage:
|
27
|
+
# Automatically included if $monitor=yes
|
28
|
+
# Use the variable $monitor_tool (can be an array) to define the monitoring software you want to use.
|
29
|
+
# To customize specific and more granular behaviours use the above variables and eventually your custom modulename::monitor::$my_project class
|
30
|
+
#
|
31
|
+
class mysql::monitor {
|
32
|
+
|
33
|
+
include mysql::params
|
34
|
+
|
35
|
+
# Port monitoring
|
36
|
+
monitor::port { "mysql_${mysql::params::protocol}_${mysql::params::port}":
|
37
|
+
protocol => "${mysql::params::protocol}",
|
38
|
+
port => "${mysql::params::port}",
|
39
|
+
target => "${mysql::params::monitor_target_real}",
|
40
|
+
enable => "${mysql::params::monitor_port_enable}",
|
41
|
+
checksource => "local", # When MySql binds to localhost
|
42
|
+
tool => "${monitor_tool}",
|
43
|
+
}
|
44
|
+
|
45
|
+
# URL monitoring
|
46
|
+
monitor::url { "mysql_url":
|
47
|
+
url => "${mysql::params::monitor_baseurl_real}/index.php",
|
48
|
+
pattern => "${mysql::params::monitor_url_pattern}",
|
49
|
+
enable => "${mysql::params::monitor_url_enable}",
|
50
|
+
tool => "${monitor_tool}",
|
51
|
+
}
|
52
|
+
|
53
|
+
# Process monitoring
|
54
|
+
monitor::process { "mysql_process":
|
55
|
+
process => "${mysql::params::processname}",
|
56
|
+
service => "${mysql::params::servicename}",
|
57
|
+
pidfile => "${mysql::params::pidfile}",
|
58
|
+
enable => "${mysql::params::monitor_process_enable}",
|
59
|
+
tool => "${monitor_tool}",
|
60
|
+
}
|
61
|
+
|
62
|
+
# Use a specific plugin (according to the monitor tool used)
|
63
|
+
monitor::plugin { "mysql_plugin":
|
64
|
+
plugin => "mysql",
|
65
|
+
enable => "${mysql::params::monitor_plugin_enable}",
|
66
|
+
tool => "${monitor_tool}",
|
67
|
+
}
|
68
|
+
|
69
|
+
# Include project specific monitor class if $my_project is set
|
70
|
+
if $my_project {
|
71
|
+
case $my_project_onmodule {
|
72
|
+
yes,true: { include "${my_project}::mysql::monitor" }
|
73
|
+
default: { include "mysql::monitor::${my_project}" }
|
74
|
+
}
|
75
|
+
}
|
76
|
+
|
77
|
+
}
|