provizioning 0.9.18 → 0.9.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -13,6 +13,7 @@ Capistrano::Configuration.instance(:must_exist).load do
13
13
  task :deploy_recipes do
14
14
  with_puppet_user do
15
15
  run "#{try_sudo} rm -rf #{puppet_path}"
16
+ run "mkdir -p #{puppet_path}"
16
17
  upload File.expand_path("../../../puppet", __FILE__), puppet_path
17
18
  end
18
19
  end
@@ -44,6 +45,7 @@ Capistrano::Configuration.instance(:must_exist).load do
44
45
  deploy_recipes
45
46
  with_puppet_user do
46
47
  if File.directory?("config/puppet")
48
+ run "mkdir -p #{puppet_app_modules_path}"
47
49
  upload File.expand_path("config/puppet"), puppet_app_modules_path
48
50
  end
49
51
  end
@@ -1,3 +1,3 @@
1
1
  module Provizioning
2
- VERSION = "0.9.18"
2
+ VERSION = "0.9.19"
3
3
  end
@@ -41,6 +41,11 @@ class mysql {
41
41
  enable => true
42
42
  }
43
43
 
44
+ file {"/etc/mysql/conf.d/character-set.cnf":
45
+ content => "[mysqld]\ncharacter-set-server=utf8",
46
+ notify => Service[mysql-server],
47
+ }
48
+
44
49
  exec { "Initialize MySQL server root password":
45
50
  unless => "/usr/bin/test -f /root/.my.cnf",
46
51
  command => "/usr/bin/mysqladmin -uroot password ${mysql_password}",
@@ -56,14 +61,14 @@ class mysql {
56
61
 
57
62
  define db( $user, $password ) {
58
63
  exec { "create-${name}-db":
59
- unless => "/usr/bin/mysql -uroot ${name}",
60
- command => "/usr/bin/mysql -uroot -e \"create database ${name};\"",
64
+ unless => "/usr/bin/mysql --defaults-file=/root/.my.cnf -uroot ${name}",
65
+ command => "/usr/bin/mysql --defaults-file=/root/.my.cnf -uroot -e \"create database ${name};\"",
61
66
  require => Service[mysql-server],
62
67
  }
63
68
 
64
69
  exec { "grant-${name}-db":
65
- unless => "/usr/bin/mysql -u${user} -p${password} ${name}",
66
- command => "/usr/bin/mysql -uroot -e \"grant all on ${name}.* to ${user}@localhost identified by '$password';\"",
70
+ unless => "/usr/bin/mysql --defaults-file=/root/.my.cnf -u${user} -p${password} ${name}",
71
+ command => "/usr/bin/mysql --defaults-file=/root/.my.cnf -uroot -e \"grant all on ${name}.* to ${user}@localhost identified by '$password';\"",
67
72
  require => [Service[mysql-server], Exec["create-${name}-db"]]
68
73
  }
69
74
  }
@@ -32,7 +32,8 @@ class postgres {
32
32
 
33
33
  class ubuntu {
34
34
  exec {"get-postgres-apt-key":
35
- command => "apt-key adv --keyserver keyserver.ubuntu.com --recv 8683D8A2"
35
+ command => "apt-key adv --keyserver keyserver.ubuntu.com --recv 8683D8A2",
36
+ unless => "apt-key list | grep 8683D8A2",
36
37
  }
37
38
 
38
39
  file {"/etc/apt/sources.list.d/postgres.list":
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: provizioning
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.18
4
+ version: 0.9.19
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-26 00:00:00.000000000 Z
12
+ date: 2013-04-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: capistrano
@@ -161,27 +161,6 @@ files:
161
161
  - puppet/modules/iptables/manifests/disable.pp
162
162
  - puppet/modules/iptables/manifests/init.pp
163
163
  - puppet/modules/iptables/manifests/redhat.pp
164
- - puppet/modules/mysql/Modulefile
165
- - puppet/modules/mysql/README
166
- - puppet/modules/mysql/manifests/absent.pp
167
- - puppet/modules/mysql/manifests/backup.pp
168
- - puppet/modules/mysql/manifests/backup/example42.pp
169
- - puppet/modules/mysql/manifests/client.pp
170
- - puppet/modules/mysql/manifests/conf.pp
171
- - puppet/modules/mysql/manifests/debug.pp
172
- - puppet/modules/mysql/manifests/disable.pp
173
- - puppet/modules/mysql/manifests/disableboot.pp
174
- - puppet/modules/mysql/manifests/example42.pp
175
- - puppet/modules/mysql/manifests/firewall.pp
176
- - puppet/modules/mysql/manifests/grant.pp
177
- - puppet/modules/mysql/manifests/init.pp
178
- - puppet/modules/mysql/manifests/monitor.pp
179
- - puppet/modules/mysql/manifests/monitor/example42.pp
180
- - puppet/modules/mysql/manifests/params.pp
181
- - puppet/modules/mysql/manifests/query.pp
182
- - puppet/modules/mysql/templates/grant.erb
183
- - puppet/modules/mysql/templates/query.erb
184
- - puppet/modules/mysql/templates/variables_mysql.erb
185
164
  - puppet/modules/network/README
186
165
  - puppet/modules/network/manifests/init.pp
187
166
  - puppet/modules/nginx/files/init-php-fastcgi
@@ -1,7 +0,0 @@
1
- name 'lab42-mysql'
2
- version '0.1.1'
3
-
4
- # dependency 'lab42/common', '>= 0.0.1'
5
- # dependency 'lab42/monitor', '>= 0.0.1'
6
- # dependency 'lab42/backup', '>= 0.0.1'
7
- # dependency 'lab42/firewall', '>= 0.0.1'
@@ -1,56 +0,0 @@
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.
@@ -1,12 +0,0 @@
1
- # Class: mysql::absent
2
- #
3
- # Removes mysql package
4
- #
5
- # Usage:
6
- # include mysql::absent
7
- #
8
- class mysql::absent inherits mysql {
9
- Package["mysql"] {
10
- ensure => "absent" ,
11
- }
12
- }
@@ -1,49 +0,0 @@
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
- }
@@ -1,8 +0,0 @@
1
- # Class mysql::backup::example42
2
- #
3
- # Custom backup class for example42 project.
4
- # Here you can override or define your settings for the backup wrapper
5
- #
6
- class mysql::backup::example42 inherits mysql::backup {
7
-
8
- }
@@ -1,18 +0,0 @@
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
-
@@ -1,23 +0,0 @@
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
- }
@@ -1,25 +0,0 @@
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
- }
@@ -1,13 +0,0 @@
1
- # Class: mysql::disable
2
- #
3
- # Stops mysql service and disables it at boot time
4
- #
5
- # Usage:
6
- # include mysql::disable
7
- #
8
- class mysql::disable inherits mysql {
9
- Service["mysql"] {
10
- ensure => "stopped" ,
11
- enable => "false",
12
- }
13
- }
@@ -1,13 +0,0 @@
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
- }
@@ -1,25 +0,0 @@
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
- }
@@ -1,23 +0,0 @@
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
- }
@@ -1,29 +0,0 @@
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
-
@@ -1,67 +0,0 @@
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
- }
@@ -1,77 +0,0 @@
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
- }
@@ -1,8 +0,0 @@
1
- # Class mysql::monitor::example42
2
- #
3
- # Custom monitor class for example42 project.
4
- # Here you can override or define your settings for the monitor wrapper
5
- #
6
- class mysql::monitor::example42 inherits mysql::monitor {
7
-
8
- }
@@ -1,240 +0,0 @@
1
- # Class: mysql::params
2
- #
3
- # Sets internal variables and defaults for mysql module
4
- # This class is automatically loaded in all the classes that use the values set here
5
- #
6
- class mysql::params {
7
-
8
- ## DEFAULTS FOR VARIABLES USERS CAN SET
9
- # (Here are set the defaults, provide your custom variables externally)
10
- # (The default used is in the line with '')
11
-
12
-
13
-
14
- ## MODULE INTERNAL VARIABLES
15
- # (Modify to adapt to unsupported OSes)
16
-
17
- $packagename = $operatingsystem ? {
18
- default => "mysql-server",
19
- }
20
-
21
- $packagename_client = $operatingsystem ? {
22
- redhat => "mysql",
23
- centos => "mysql",
24
- default => "mysql-client",
25
- }
26
-
27
- $servicename = $operatingsystem ? {
28
- redhat => "mysqld",
29
- centos => "mysqld",
30
- default => "mysql",
31
- }
32
-
33
- $processname = $operatingsystem ? {
34
- default => "mysqld",
35
- }
36
-
37
- $hasstatus = $operatingsystem ? {
38
- debian => false,
39
- ubuntu => false,
40
- default => true,
41
- }
42
-
43
- $configfile = $operatingsystem ? {
44
- debian => "/etc/mysql/my.cnf",
45
- ubuntu => "/etc/mysql/my.cnf",
46
- default => "/etc/my.cnf",
47
- }
48
-
49
- $configfile_mode = $operatingsystem ? {
50
- default => "644",
51
- }
52
-
53
- $configfile_owner = $operatingsystem ? {
54
- default => "root",
55
- }
56
-
57
- $configfile_group = $operatingsystem ? {
58
- default => "root",
59
- }
60
-
61
- $configdir = $operatingsystem ? {
62
- default => "/etc/mysql/conf.d",
63
- }
64
-
65
- $initconfigfile = $operatingsystem ? {
66
- debian => "/etc/default/mysql",
67
- ubuntu => "/etc/default/mysql",
68
- default => "/etc/sysconfig/mysqld",
69
- }
70
-
71
- # Used by monitor class
72
- $pidfile = $operatingsystem ? {
73
- default => "/var/run/mysqld/mysqld.pid",
74
- }
75
-
76
- # Used by backup class
77
- $datadir = $operatingsystem ? {
78
- default => "/var/lib/mysql",
79
- }
80
-
81
- # Used by backup class - Provide the file name, if there's no dedicated dir
82
- $logdir = $operatingsystem ? {
83
- default => "/var/log/mysql",
84
- }
85
-
86
- # Used by monitor and firewall class
87
- # If you need to define additional ports, call them $protocol1/$port1 and add the relevant
88
- # parts in firewall.pp and monitor.pp
89
- $protocol = "tcp"
90
- $port = "3306"
91
-
92
-
93
-
94
- ## DEFAULTS FOR MONITOR CLASS
95
- # These are settings that influence the (optional) mysql::monitor class
96
- # You can define these variables or leave the defaults
97
- # The apparently complex variables assignements below follow this logic:
98
- # - If no user variable is set, a reasonable default is used
99
- # - If the user has set a host-wide variable (ex: $monitor_target ) that one is set
100
- # - The host-wide variable can be overriden by a module specific one (ex: $mysql_monitor_target)
101
-
102
- # How the monitor server refers to the monitor target
103
- $monitor_target_real = $mysql_monitor_target ? {
104
- '' => $monitor_target ? {
105
- '' => "${fqdn}",
106
- default => $monitor_target,
107
- },
108
- default => "$mysql_monitor_target",
109
- }
110
-
111
- # BaseUrl to access this host
112
- $monitor_baseurl_real = $mysql_monitor_baseurl ? {
113
- '' => $monitor_baseurl ? {
114
- '' => "http://${fqdn}",
115
- default => $monitor_baseurl,
116
- },
117
- default => "${mysql_monitor_baseurl}",
118
- }
119
-
120
- # Pattern to look for in the URL defined in mysql::monitor class
121
- $monitor_url_pattern = $mysql_monitor_url_pattern ? {
122
- '' => "OK",
123
- default => "${mysql_monitor_url_pattern}",
124
- }
125
-
126
- # If mysql port monitoring is enabled
127
- $monitor_port_enable = $mysql_monitor_port ? {
128
- '' => $monitor_port ? {
129
- '' => true,
130
- default => $monitor_port,
131
- },
132
- default => $mysql_monitor_port,
133
- }
134
-
135
- # If mysql url monitoring is enabled
136
- $monitor_url_enable = $mysql_monitor_url ? {
137
- '' => $monitor_url ? {
138
- '' => false,
139
- default => $monitor_url,
140
- },
141
- default => $mysql_monitor_url,
142
- }
143
-
144
- # If mysql process monitoring is enabled
145
- $monitor_process_enable = $mysql_monitor_process ? {
146
- '' => $monitor_process ? {
147
- '' => true,
148
- default => $monitor_process,
149
- },
150
- default => $mysql_monitor_process,
151
- }
152
-
153
- # If mysql plugin monitoring is enabled
154
- $monitor_plugin_enable = $mysql_monitor_plugin ? {
155
- '' => $monitor_plugin ? {
156
- '' => true,
157
- default => $monitor_plugin,
158
- },
159
- default => $mysql_monitor_plugin,
160
- }
161
-
162
- ## DEFAULTS FOR BACKUP CLASS
163
- # These are settings that influence the (optional) mysql::backup class
164
- # You can define these variables or leave the defaults
165
-
166
- # How the backup server refers to the backup target
167
- $backup_target_real = $mysql_backup_target ? {
168
- '' => $backup_target ? {
169
- '' => "${fqdn}",
170
- default => $backup_target,
171
- },
172
- default => "$mysql_backup_target",
173
- }
174
-
175
- # Frequency of backups
176
- $backup_frequency = $mysql_backup_frequency ? {
177
- '' => "daily",
178
- default => "$mysql_backup_frequency",
179
- }
180
-
181
- # If mysql data have to be backed up
182
- $backup_data_enable = $mysql_backup_data ? {
183
- '' => $backup_data ? {
184
- '' => true,
185
- default => $backup_data,
186
- },
187
- default => $mysql_backup_data,
188
- }
189
-
190
- # If mysql logs have to be backed up
191
- $backup_log_enable = $mysql_backup_log ? {
192
- '' => $backup_log ? {
193
- '' => true,
194
- default => $backup_log,
195
- },
196
- default => $mysql_backup_log,
197
- }
198
-
199
-
200
- ## DEFAULTS FOR FIREWALL CLASS
201
- # These are settings that influence the (optional) mysql::firewall class
202
- # You can define these variables or leave the defaults
203
-
204
- # Source IPs that can access this service - Use iptables friendly format
205
- $firewall_source_real = $mysql_firewall_source ? {
206
- '' => $firewall_source ? {
207
- '' => "0.0.0.0/0",
208
- default => $firewall_source,
209
- },
210
- default => "$mysql_firewall_source",
211
- }
212
-
213
- # Destination IP to use for this host (Default facter's $ipaddress)
214
- $firewall_destination_real = $mysql_firewall_destination ? {
215
- '' => $firewall_destination ? {
216
- '' => "${ipaddress}",
217
- default => $firewall_destination,
218
- },
219
- default => "$mysql_firewall_destination",
220
- }
221
-
222
- ## FILE SERVING SOURCE
223
- # Sets the correct source for static files
224
- # In order to provide files from different sources without modifying the module
225
- # you can override the default source path setting the variable $base_source
226
- # Ex: $base_source="puppet://ip.of.fileserver" or $base_source="puppet://$servername/myprojectmodule"
227
- # What follows automatically manages the new source standard (with /modules/) from 0.25
228
-
229
- case $base_source {
230
- '': {
231
- $general_base_source = $puppetversion ? {
232
- /(^0.25)/ => "puppet:///modules",
233
- /(^0.)/ => "puppet://$servername",
234
- default => "puppet:///modules",
235
- }
236
- }
237
- default: { $general_base_source=$base_source }
238
- }
239
-
240
- }
@@ -1,30 +0,0 @@
1
- define mysql::query (
2
- $mysql_db,
3
- $mysql_user = "root",
4
- $mysql_password = "",
5
- $mysql_host = "localhost",
6
- $mysql_query,
7
- $mysql_query_filepath = "/root"
8
- ) {
9
-
10
- file {
11
- "mysqlquery-$mysql_user-$mysql_db.sql":
12
- mode => 600, owner => root, group => root,
13
- ensure => present,
14
- path => "$mysql_query_filepath/mysqlquery-$mysql_user-$mysql_db.sql",
15
- content => template("mysql/query.erb"),
16
- notify => Exec["mysqlquery-$mysql_user-$mysql_db"],
17
- require => Service["mysql"],
18
- }
19
-
20
- exec {
21
- "mysqlquery-$mysql_user-$mysql_db":
22
- command => "mysql < $mysql_query_filepath/mysqlquery-$mysql_user-$mysql_db.sql",
23
- require => File["mysqlquery-$mysql_user-$mysql_db.sql"],
24
- refreshonly => true,
25
- subscribe => File["mysqlquery-$mysql_user-$mysql_db.sql"],
26
- }
27
-
28
- }
29
-
30
-
@@ -1,6 +0,0 @@
1
- # File managed by Puppet
2
-
3
- CREATE DATABASE IF NOT EXISTS <%= mysql_db %> ;
4
- GRANT <%= mysql_privileges %> ON <%= mysql_db %>.* TO '<%= mysql_user %>'@'<%= mysql_host %>' IDENTIFIED BY '<%= mysql_password %>';
5
- FLUSH PRIVILEGES ;
6
-
@@ -1,5 +0,0 @@
1
- # File managed by Puppet
2
-
3
- USE <%= mysql_db %> ;
4
- <%= mysql_query %> ;
5
-
@@ -1,42 +0,0 @@
1
- # File Managed By Puppet
2
-
3
- These are the variables used by the module mysql
4
-
5
- User variables:
6
-
7
- General internal variables:
8
- $packagename = <%= scope.lookupvar('mysql::params::packagename') %>
9
- $servicename = <%= scope.lookupvar('mysql::params::servicename') %>
10
- $processname = <%= scope.lookupvar('mysql::params::servicename') %>
11
- $hasstatus = <%= scope.lookupvar('mysql::params::hasstatus') %>
12
- $configfile = <%= scope.lookupvar('mysql::params::configfile') %>
13
- $configfile_mode = <%= scope.lookupvar('mysql::params::configfile_mode') %>
14
- $configfile_owner = <%= scope.lookupvar('mysql::params::configfile_owner') %>
15
- $configfile_group = <%= scope.lookupvar('mysql::params::configfile_group') %>
16
- $configdir = <%= scope.lookupvar('mysql::params::configdir') %>
17
- $initconfigfile = <%= scope.lookupvar('mysql::params::initconfigfile') %>
18
- $pidfile = <%= scope.lookupvar('mysql::params::pidfile') %>
19
- $datadir = <%= scope.lookupvar('mysql::params::datadir') %>
20
- $logdir = <%= scope.lookupvar('mysql::params::logdir') %>
21
- $protocol = <%= scope.lookupvar('mysql::params::protocol') %>
22
- $port = <%= scope.lookupvar('mysql::params::port') %>
23
-
24
- Variables used by monitor class:
25
- $monitor_target_real = <%= scope.lookupvar('mysql::params::monitor_target_real') %>
26
- $monitor_baseurl_real = <%= scope.lookupvar('mysql::params::monitor_baseurl_real') %>
27
- $monitor_url_pattern = <%= scope.lookupvar('mysql::params::monitor_url_pattern') %>
28
- $monitor_port_enable = <%= scope.lookupvar('mysql::params::monitor_port_enable') %>
29
- $monitor_url_enable = <%= scope.lookupvar('mysql::params::monitor_url_enable') %>
30
- $monitor_process_enable = <%= scope.lookupvar('mysql::params::monitor_process_enable') %>
31
- $monitor_plugin_enable = <%= scope.lookupvar('mysql::params::monitor_plugin_enable') %>
32
-
33
- Variables used by backup class:
34
- $backup_target_real = <%= scope.lookupvar('mysql::params::backup_target_real') %>
35
- $backup_frequency = <%= scope.lookupvar('mysql::params::backup_frequency') %>
36
- $backup_data_enable = <%= scope.lookupvar('mysql::params::backup_data_enable') %>
37
- $backup_log_enable = <%= scope.lookupvar('mysql::params::backup_log_enable') %>
38
- $general_base_source = <%= scope.lookupvar('mysql::params::general_base_source') %>
39
-
40
- Variables used by firewall class:
41
- $firewall_source_real = <%= scope.lookupvar('mysql::params::firewall_source_real') %>
42
- $firewall_destination_real = <%= scope.lookupvar('mysql::params::firewall_destination_real') %>