provizioning 0.1.2 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (223) hide show
  1. data/.gitignore +17 -0
  2. data/Gemfile +4 -0
  3. data/README.md +29 -0
  4. data/Rakefile +2 -0
  5. data/bootstrap/bootstrap.sh +71 -0
  6. data/{lib/templates/sources.list → bootstrap/lucid.sources.list} +2 -1
  7. data/bootstrap/natty.sources.list +14 -0
  8. data/lib/provizioning/puppet.rb +94 -0
  9. data/lib/provizioning/version.rb +3 -0
  10. data/lib/provizioning.rb +1 -3
  11. data/provizioning.gemspec +20 -0
  12. data/puppet/classes/apache/centos.conf +978 -0
  13. data/puppet/classes/apache/ssl.conf +75 -0
  14. data/puppet/classes/apache.pp +152 -0
  15. data/puppet/classes/apt.pp +5 -0
  16. data/puppet/classes/base/ntp/ntpd-sysconfig +13 -0
  17. data/puppet/classes/base.pp +79 -0
  18. data/puppet/classes/freerange.pp +53 -0
  19. data/puppet/classes/gemrc/gemrc +9 -0
  20. data/puppet/classes/gemrc.pp +10 -0
  21. data/puppet/classes/imagemagick.pp +19 -0
  22. data/puppet/classes/iptables/load-iptables +3 -0
  23. data/puppet/classes/iptables/post-iptables +2 -0
  24. data/puppet/classes/iptables/pre-iptables +2 -0
  25. data/puppet/classes/iptables.pp +59 -0
  26. data/puppet/classes/logrotate/logrotate.erb +15 -0
  27. data/puppet/classes/logrotate.pp +37 -0
  28. data/puppet/classes/mongo/mongodb.conf +89 -0
  29. data/puppet/classes/mongo.pp +86 -0
  30. data/puppet/classes/monit/monit.conf +242 -0
  31. data/puppet/classes/monit.pp +39 -0
  32. data/puppet/classes/munin/plugins/passenger_memory_stats +123 -0
  33. data/puppet/classes/munin/plugins/passenger_status +130 -0
  34. data/puppet/classes/munin/plugins/rails_database_time +174 -0
  35. data/puppet/classes/munin/plugins/rails_request_duration +173 -0
  36. data/puppet/classes/munin/plugins/rails_request_error +169 -0
  37. data/puppet/classes/munin/plugins/rails_requests +175 -0
  38. data/puppet/classes/munin/plugins/rails_view_render_time +173 -0
  39. data/puppet/classes/munin/rails-plugin-config +4 -0
  40. data/puppet/classes/munin.pp +60 -0
  41. data/puppet/classes/mysql/password.erb +1 -0
  42. data/puppet/classes/mysql.pp +71 -0
  43. data/puppet/classes/openswan/ipsec.conf +17 -0
  44. data/puppet/classes/openswan/ipsec.secrets +1 -0
  45. data/puppet/classes/openswan/patched_ipsec_initd_script +223 -0
  46. data/puppet/classes/openswan/secret.erb +1 -0
  47. data/puppet/classes/openswan.pp +71 -0
  48. data/puppet/classes/post-flight.pp +17 -0
  49. data/puppet/classes/postfix/main.cf +39 -0
  50. data/puppet/classes/postfix.pp +16 -0
  51. data/puppet/classes/rack/centos/passenger.load.erb +5 -0
  52. data/puppet/classes/rack/ubuntu/passenger.conf.erb +6 -0
  53. data/puppet/classes/rack.pp +66 -0
  54. data/puppet/classes/redis/redis.conf.erb +187 -0
  55. data/puppet/classes/redis.pp +20 -0
  56. data/puppet/classes/sudo/sudoers +6 -0
  57. data/puppet/classes/sudo.pp +24 -0
  58. data/puppet/classes/syslogng/CentOS.cnf +61 -0
  59. data/puppet/classes/syslogng/Ubuntu.cnf +347 -0
  60. data/puppet/classes/syslogng.pp +146 -0
  61. data/puppet/classes/xml.pp +23 -0
  62. data/puppet/classes/yum.pp +6 -0
  63. data/puppet/classes/zsh.pp +5 -0
  64. data/puppet/modules/README +74 -0
  65. data/puppet/modules/cron/README +4 -0
  66. data/puppet/modules/cron/manifests/base.pp +26 -0
  67. data/puppet/modules/cron/manifests/crontabs.pp +11 -0
  68. data/puppet/modules/cron/manifests/init.pp +18 -0
  69. data/puppet/modules/drupal/Modulefile +7 -0
  70. data/puppet/modules/drupal/README +110 -0
  71. data/puppet/modules/drupal/manifests/absent.pp +25 -0
  72. data/puppet/modules/drupal/manifests/backup/absent.pp +23 -0
  73. data/puppet/modules/drupal/manifests/backup.pp +49 -0
  74. data/puppet/modules/drupal/manifests/conf.pp +23 -0
  75. data/puppet/modules/drupal/manifests/debug.pp +26 -0
  76. data/puppet/modules/drupal/manifests/disable.pp +22 -0
  77. data/puppet/modules/drupal/manifests/disableboot.pp +13 -0
  78. data/puppet/modules/drupal/manifests/drush.pp +20 -0
  79. data/puppet/modules/drupal/manifests/example42/backup.pp +8 -0
  80. data/puppet/modules/drupal/manifests/example42/monitor.pp +8 -0
  81. data/puppet/modules/drupal/manifests/example42.pp +25 -0
  82. data/puppet/modules/drupal/manifests/extra.pp +30 -0
  83. data/puppet/modules/drupal/manifests/firewall/absent.pp +19 -0
  84. data/puppet/modules/drupal/manifests/firewall.pp +24 -0
  85. data/puppet/modules/drupal/manifests/init.pp +54 -0
  86. data/puppet/modules/drupal/manifests/install.pp +20 -0
  87. data/puppet/modules/drupal/manifests/module.pp +37 -0
  88. data/puppet/modules/drupal/manifests/monitor/absent.pp +42 -0
  89. data/puppet/modules/drupal/manifests/monitor.pp +77 -0
  90. data/puppet/modules/drupal/manifests/package.pp +20 -0
  91. data/puppet/modules/drupal/manifests/params.pp +277 -0
  92. data/puppet/modules/drupal/manifests/site.pp +63 -0
  93. data/puppet/modules/drupal/manifests/theme.pp +33 -0
  94. data/puppet/modules/drupal/templates/variables_drupal.erb +62 -0
  95. data/puppet/modules/drupal/tests/absent.pp +1 -0
  96. data/puppet/modules/drupal/tests/backup.pp +1 -0
  97. data/puppet/modules/drupal/tests/debug.pp +1 -0
  98. data/puppet/modules/drupal/tests/disable.pp +1 -0
  99. data/puppet/modules/drupal/tests/disableboot.pp +1 -0
  100. data/puppet/modules/drupal/tests/firewall.pp +1 -0
  101. data/puppet/modules/drupal/tests/init.pp +1 -0
  102. data/puppet/modules/drupal/tests/monitor.pp +1 -0
  103. data/puppet/modules/hosts/README +0 -0
  104. data/puppet/modules/hosts/manifests/example42.pp +5 -0
  105. data/puppet/modules/hosts/manifests/init.pp +16 -0
  106. data/puppet/modules/hosts/templates/hosts.erb +11 -0
  107. data/puppet/modules/iptables/README +4 -0
  108. data/puppet/modules/iptables/files/iptables +19 -0
  109. data/puppet/modules/iptables/manifests/disable.pp +15 -0
  110. data/puppet/modules/iptables/manifests/init.pp +9 -0
  111. data/puppet/modules/iptables/manifests/redhat.pp +24 -0
  112. data/puppet/modules/mysql/Modulefile +7 -0
  113. data/puppet/modules/mysql/README +56 -0
  114. data/puppet/modules/mysql/manifests/absent.pp +12 -0
  115. data/puppet/modules/mysql/manifests/backup/example42.pp +8 -0
  116. data/puppet/modules/mysql/manifests/backup.pp +49 -0
  117. data/puppet/modules/mysql/manifests/client.pp +18 -0
  118. data/puppet/modules/mysql/manifests/conf.pp +23 -0
  119. data/puppet/modules/mysql/manifests/debug.pp +25 -0
  120. data/puppet/modules/mysql/manifests/disable.pp +13 -0
  121. data/puppet/modules/mysql/manifests/disableboot.pp +13 -0
  122. data/puppet/modules/mysql/manifests/example42.pp +25 -0
  123. data/puppet/modules/mysql/manifests/firewall.pp +23 -0
  124. data/puppet/modules/mysql/manifests/grant.pp +29 -0
  125. data/puppet/modules/mysql/manifests/init.pp +67 -0
  126. data/puppet/modules/mysql/manifests/monitor/example42.pp +8 -0
  127. data/puppet/modules/mysql/manifests/monitor.pp +77 -0
  128. data/puppet/modules/mysql/manifests/params.pp +240 -0
  129. data/puppet/modules/mysql/manifests/query.pp +30 -0
  130. data/puppet/modules/mysql/templates/grant.erb +6 -0
  131. data/puppet/modules/mysql/templates/query.erb +5 -0
  132. data/puppet/modules/mysql/templates/variables_mysql.erb +42 -0
  133. data/puppet/modules/network/README +4 -0
  134. data/puppet/modules/network/manifests/init.pp +13 -0
  135. data/puppet/modules/nginx/manifests/fcgi.pp +87 -0
  136. data/puppet/modules/nginx/manifests/init.pp +205 -0
  137. data/puppet/modules/nginx/templates/fcgi_site.erb +38 -0
  138. data/puppet/modules/nginx/templates/includes/fastcgi_params.erb +23 -0
  139. data/puppet/modules/nginx/templates/nginx.conf.erb +31 -0
  140. data/puppet/modules/passenger/manifests/init.pp +12 -0
  141. data/puppet/modules/passenger/templates/myapp +39 -0
  142. data/puppet/modules/php/README +26 -0
  143. data/puppet/modules/php/manifests/init.pp +42 -0
  144. data/puppet/modules/php/manifests/module.pp +22 -0
  145. data/puppet/modules/php/manifests/pear/module.pp +21 -0
  146. data/puppet/modules/php/manifests/pear.pp +20 -0
  147. data/puppet/modules/php/manifests/pecl/config.pp +19 -0
  148. data/puppet/modules/php/manifests/pecl/module.pp +44 -0
  149. data/puppet/modules/php/manifests/pecl.pp +8 -0
  150. data/puppet/modules/php/manifests/soap.pp +20 -0
  151. data/puppet/modules/postgres/Copyright +13 -0
  152. data/puppet/modules/postgres/manifests/database.pp +40 -0
  153. data/puppet/modules/postgres/manifests/init.pp +25 -0
  154. data/puppet/modules/postgres/manifests/role.pp +40 -0
  155. data/puppet/modules/ruby/files/install-ruby-stow +43 -0
  156. data/puppet/modules/ruby/manifests/init.pp +18 -0
  157. data/puppet/modules/rvm/files/install-system-rvm +2 -0
  158. data/puppet/modules/rvm/manifests/classes/dependencies.pp +24 -0
  159. data/puppet/modules/rvm/manifests/classes/passenger.pp +166 -0
  160. data/puppet/modules/rvm/manifests/classes/system.pp +33 -0
  161. data/puppet/modules/rvm/manifests/definitions/system_user.pp +13 -0
  162. data/puppet/modules/rvm/manifests/init.pp +2 -0
  163. data/puppet/modules/rvm/templates/passenger-apache.conf.erb +9 -0
  164. data/puppet/modules/ssh/README +4 -0
  165. data/puppet/modules/ssh/manifests/auth.pp +39 -0
  166. data/puppet/modules/ssh/manifests/auth.pp.good +340 -0
  167. data/puppet/modules/ssh/manifests/eal4.pp +69 -0
  168. data/puppet/modules/ssh/manifests/init.pp +74 -0
  169. data/puppet/modules/stow/manifests/init.pp +5 -0
  170. data/puppet/modules/sudo/files/sudoers +25 -0
  171. data/puppet/modules/sudo/manifests/init.pp +1 -0
  172. data/puppet/modules/sudo/manifests/install.pp +5 -0
  173. data/puppet/modules/sudo/manifests/sudoers.pp +14 -0
  174. data/puppet/modules/ufw/manifests/init.pp +12 -0
  175. data/puppet/modules/users/README +28 -0
  176. data/puppet/modules/users/manifests/adduser.pp +16 -0
  177. data/puppet/modules/users/manifests/admin.pp +11 -0
  178. data/puppet/modules/users/manifests/automount.pp +34 -0
  179. data/puppet/modules/users/manifests/deluser.pp +8 -0
  180. data/puppet/modules/users/manifests/example42.pp +16 -0
  181. data/puppet/modules/users/manifests/init.pp +31 -0
  182. data/puppet/modules/users/manifests/ldap.pp +114 -0
  183. data/puppet/modules/users/manifests/params.pp +84 -0
  184. data/puppet/modules/users/templates/ldap/ldap.conf.erb +13 -0
  185. data/puppet/modules/users/templates/ldap/nsswitch.conf.erb +23 -0
  186. data/puppet/modules/users/templates/ldap/openldap-ldap.conf.erb +8 -0
  187. data/puppet/modules/webmin/manifests/init.pp +31 -0
  188. data/puppet/roles/blank.pp +1 -0
  189. data/puppet/site.pp +8 -0
  190. metadata +235 -81
  191. data/README +0 -3
  192. data/bin/provizion +0 -52
  193. data/lib/policies/chef-client.rb +0 -37
  194. data/lib/policies/lamp.rb +0 -42
  195. data/lib/policies/passenger.rb +0 -44
  196. data/lib/recipes/apache.rb +0 -70
  197. data/lib/recipes/apache_conf.rb +0 -3
  198. data/lib/recipes/bundler.rb +0 -4
  199. data/lib/recipes/chef_client.rb +0 -11
  200. data/lib/recipes/curl.rb +0 -8
  201. data/lib/recipes/essential.rb +0 -4
  202. data/lib/recipes/git.rb +0 -15
  203. data/lib/recipes/imagemagick.rb +0 -8
  204. data/lib/recipes/mailserver.rb +0 -9
  205. data/lib/recipes/memcached.rb +0 -16
  206. data/lib/recipes/mysql.rb +0 -21
  207. data/lib/recipes/nginx/init.d +0 -63
  208. data/lib/recipes/nginx.rb +0 -25
  209. data/lib/recipes/passenger.rb +0 -67
  210. data/lib/recipes/php.rb +0 -8
  211. data/lib/recipes/postgresql.rb +0 -21
  212. data/lib/recipes/ruby_enterprise.rb +0 -24
  213. data/lib/recipes/rvm.rb +0 -25
  214. data/lib/recipes/sources.rb +0 -5
  215. data/lib/recipes/subversion.rb +0 -8
  216. data/lib/recipes/syslog.rb +0 -7
  217. data/lib/recipes/ufw.rb +0 -12
  218. data/lib/recipes/vim.rb +0 -8
  219. data/lib/recipes/webmin.rb +0 -17
  220. data/lib/templates/apache.conf.erb +0 -12
  221. data/lib/templates/my.cnf +0 -132
  222. data/lib/templates/passenger.conf +0 -11
  223. data/lib/templates/passenger.load +0 -1
@@ -0,0 +1,77 @@
1
+ # Class: drupal::monitor
2
+ #
3
+ # Monitors drupal process/ports/service using Example42 monitor meta module (to be adapted to custom monitor solutions)
4
+ # It's automatically included and 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 that instantly notifies what's working and what's needs
7
+ # to be fixed (call it Test Driven Puppet Deployment, if you like ;-)
8
+ #
9
+ # Variables:
10
+ # The behaviour of this class has some defaults that can be overriden by user's variables:
11
+ # $drupal_monitor_port (true|false) : Set if you want to monitor drupal's port(s). If any. Default: As defined in $monitor_port
12
+ # $drupal_monitor_url (true|false) : Set if you want to monitor drupal's url(s). If any. Default: As defined in $monitor_url
13
+ # $drupal_monitor_process (true|false) : Set if you want to monitor drupal's process. If any. Default: As defined in $monitor_process
14
+ # $drupal_monitor_plugin (true|false) : Set if you want to monitor drupal using specific monitor tool's plugin i s. If any. Default: As defined in $monitor_plugin
15
+ # $drupal_monitor_target : Define how to reach (Ip, fqdn...) the host to monitor drupal from an external server. Default: As defined in $monitor_target
16
+ # $drupal_monitor_url : Define the baseurl (http://$fqdn/...) to use for eventual drupal URL checks. Default: As defined in $monitor_url
17
+ #
18
+ # You can therefore set site wide variables that can be overriden by the above module specific ones:
19
+ # $monitor_port (true|false) : Set if you want to enable port monitoring site-wide.
20
+ # $monitor_url (true|false) : Set if you want to enable url checking site-wide.
21
+ # $monitor_process (true|false) : Set if you want to enable process monitoring site-wide.
22
+ # $monitor_plugin (true|false) : Set if you want to try to use specific plugins of your monitoring tools
23
+ # $monitor_target : Set the ip/hostname you want to use on an external monitoring server to monitor this host
24
+ # $monitor_baseurl : Set baseurl to use for eventual URL checks of services provided by this host
25
+ # For the defaults of the above variables check drupal::params
26
+ #
27
+ # Usage:
28
+ # Automatically included if $monitor=yes
29
+ # Use the variable $monitor_tool (can be an array) to define the monitoring software you want to use.
30
+ # To customize specific and more granular behaviours use the above variables and eventually your custom modulename::monitor::$my_project class
31
+ #
32
+ class drupal::monitor {
33
+
34
+ include drupal::params
35
+
36
+ # Port monitoring
37
+ monitor::port { "drupal_${drupal::params::protocol}_${drupal::params::port}":
38
+ protocol => "${drupal::params::protocol}",
39
+ port => "${drupal::params::port}",
40
+ target => "${drupal::params::monitor_target_real}",
41
+ enable => "${drupal::params::monitor_port_enable}",
42
+ tool => "${monitor_tool}",
43
+ }
44
+
45
+ # URL monitoring
46
+ monitor::url { "drupal_url":
47
+ url => "${drupal::params::monitor_baseurl_real}/index.php",
48
+ pattern => "${drupal::params::monitor_url_pattern}",
49
+ enable => "${drupal::params::monitor_url_enable}",
50
+ tool => "${monitor_tool}",
51
+ }
52
+
53
+ # Process monitoring
54
+ monitor::process { "drupal_process":
55
+ process => "${drupal::params::processname}",
56
+ service => "${drupal::params::servicename}",
57
+ pidfile => "${drupal::params::pidfile}",
58
+ enable => "${drupal::params::monitor_process_enable}",
59
+ tool => "${monitor_tool}",
60
+ }
61
+
62
+ # Use a specific plugin (according to the monitor tool used)
63
+ monitor::plugin { "drupal_plugin":
64
+ plugin => "drupal",
65
+ enable => "${drupal::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}::drupal::monitor" }
73
+ default: { include "drupal::${my_project}::monitor" }
74
+ }
75
+ }
76
+
77
+ }
@@ -0,0 +1,20 @@
1
+ #
2
+ # Class: drupal::package
3
+ #
4
+ # Installs Drupal using the OS official package
5
+ #
6
+ # Usage:
7
+ # AUtoinclude if use_package=yes
8
+ #
9
+ class drupal::package {
10
+
11
+ # Load the variables used in this module. Check the params.pp file
12
+ require drupal::params
13
+
14
+ # Basic Package - Service - Configuration file management
15
+ package { "drupal":
16
+ name => "${drupal::params::packagename}",
17
+ ensure => present,
18
+ }
19
+
20
+ }
@@ -0,0 +1,277 @@
1
+ # Class: drupal::params
2
+ #
3
+ # Sets internal variables and defaults for drupal module
4
+ # This class is loaded in all the classes that use the values set here
5
+ #
6
+ class drupal::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
+ ## Download URL for Drupal's Drush
13
+ $use_package = $drupal_use_package ? {
14
+ true => "yes",
15
+ "true" => "yes",
16
+ "yes" => "yes",
17
+ default => "no",
18
+ }
19
+
20
+ $version = $drupal_version ? {
21
+ '5' => "5",
22
+ '6' => "6",
23
+ '7' => "7",
24
+ default => "7",
25
+ }
26
+
27
+ $drush_url = $drupal_drush_url ? {
28
+ '' => "http://ftp.drupal.org/files/projects/drush-7.x-4.0.tar.gz",
29
+ default => "${drupal_drush_url}",
30
+ }
31
+
32
+ $basedir = $use_package ? {
33
+ yes => $operatingsystem ? {
34
+ debian => "/usr/share/drupal6",
35
+ ubuntu => "/usr/share/drupal6",
36
+ redhat => "/usr/share/drupal",
37
+ centos => "/usr/share/drupal",
38
+ },
39
+ no => $drupal_basedir ? {
40
+ '' => "/var/www/drupal",
41
+ default => "${drupal_basedir}",
42
+ },
43
+ }
44
+
45
+ # The directory where sites dir is placed.
46
+ # (Some packages place it outside the basedir)
47
+ $sitesdir = $use_package ? {
48
+ yes => $operatingsystem ? {
49
+ debian => "/etc/drupal/6/sites",
50
+ ubuntu => "/etc/drupal/6/sites",
51
+ redhat => "/etc/drupal",
52
+ centos => "/etc/drupal",
53
+ },
54
+ no => $drupal_sitesdir ? {
55
+ '' => "$basedir/sites",
56
+ default => "${drupal_sitesdir}",
57
+ },
58
+ }
59
+
60
+ $extra = $drupal_extra ? {
61
+ true => "yes",
62
+ "true" => "yes",
63
+ "yes" => "yes",
64
+ default => "no",
65
+ }
66
+
67
+
68
+ ## EXTRA MODULE INTERNAL VARIABLES
69
+ #(add here module specific internal variables)
70
+
71
+ $drush_path = "$sitesdir/all/modules/drush/drush"
72
+
73
+ ## MODULE INTERNAL VARIABLES
74
+ # (Modify to adapt to unsupported OSes)
75
+
76
+ $packagename = $operatingsystem ? {
77
+ solaris => "CSWdrupal",
78
+ debian => "drupal",
79
+ ubuntu => "drupal",
80
+ default => "drupal",
81
+ }
82
+
83
+ $configfile = $operatingsystem ? {
84
+ freebsd => "/usr/local/etc/drupal/drupal.conf",
85
+ default => "/etc/drupal/drupal.conf",
86
+ }
87
+
88
+ $configfile_mode = $operatingsystem ? {
89
+ default => "644",
90
+ }
91
+
92
+ $configfile_owner = $operatingsystem ? {
93
+ default => "root",
94
+ }
95
+
96
+ $configfile_group = $operatingsystem ? {
97
+ default => "root",
98
+ }
99
+
100
+ $configdir = $operatingsystem ? {
101
+ default => "/etc/drupal",
102
+ }
103
+
104
+ # Used by backup class
105
+ $datadir = $operatingsystem ? {
106
+ default => "/var/www/drupal",
107
+ }
108
+
109
+ # Used by backup class - Provide the file name, if there's no dedicated dir
110
+ $logdir = $operatingsystem ? {
111
+ default => "/var/log/drupal",
112
+ }
113
+
114
+ # Used by monitor and firewall class
115
+ # If you need to define additional ports, call them $protocol1/$port1 and add the relevant
116
+ # parts in firewall.pp and monitor.pp
117
+ $protocol = "tcp"
118
+ $port = "80"
119
+
120
+
121
+
122
+ ## DEFAULTS FOR MONITOR CLASS
123
+ # These are settings that influence the (optional) drupal::monitor class
124
+ # You can define these variables or leave the defaults
125
+ # The apparently complex variables assignements below follow this logic:
126
+ # - If no user variable is set, a reasonable default is used
127
+ # - If the user has set a host-wide variable (ex: $monitor_target ) that one is set
128
+ # - The host-wide variable can be overriden by a module specific one (ex: $drupal_monitor_target)
129
+
130
+ # How the monitor server refers to the monitor target
131
+ $monitor_target_real = $drupal_monitor_target ? {
132
+ '' => $monitor_target ? {
133
+ '' => "${fqdn}",
134
+ default => $monitor_target,
135
+ },
136
+ default => "$drupal_monitor_target",
137
+ }
138
+
139
+ # BaseUrl to access this service
140
+ $monitor_baseurl_real = $drupal_monitor_baseurl ? {
141
+ '' => $monitor_baseurl ? {
142
+ '' => "http://${fqdn}",
143
+ default => $monitor_baseurl,
144
+ },
145
+ default => "${drupal_monitor_baseurl}",
146
+ }
147
+
148
+ # Pattern to look for in the URL defined in drupal::monitor class
149
+ $monitor_url_pattern = $drupal_monitor_url_pattern ? {
150
+ '' => "a", # Sane default. TO CUSTOMIZE
151
+ default => "${drupal_monitor_url_pattern}",
152
+ }
153
+
154
+ # If drupal port monitoring is enabled
155
+ $monitor_port_enable = $drupal_monitor_port ? {
156
+ '' => $monitor_port ? {
157
+ '' => false,
158
+ default => $monitor_port,
159
+ },
160
+ default => $drupal_monitor_port,
161
+ }
162
+
163
+ # If drupal url monitoring is enabled
164
+ $monitor_url_enable = $drupal_monitor_url ? {
165
+ '' => $monitor_url ? {
166
+ '' => true,
167
+ default => $monitor_url,
168
+ },
169
+ default => $drupal_monitor_url,
170
+ }
171
+
172
+ # If drupal process monitoring is enabled
173
+ $monitor_process_enable = $drupal_monitor_process ? {
174
+ '' => $monitor_process ? {
175
+ '' => false,
176
+ default => $monitor_process,
177
+ },
178
+ default => $drupal_monitor_process,
179
+ }
180
+
181
+ # If drupal plugin monitoring is enabled
182
+ $monitor_plugin_enable = $drupal_monitor_plugin ? {
183
+ '' => $monitor_plugin ? {
184
+ '' => false,
185
+ default => $monitor_plugin,
186
+ },
187
+ default => $drupal_monitor_plugin,
188
+ }
189
+
190
+ ## DEFAULTS FOR BACKUP CLASS
191
+ # These are settings that influence the (optional) drupal::backup class
192
+ # You can define these variables or leave the defaults
193
+
194
+ # How the backup server refers to the backup target
195
+ $backup_target_real = $drupal_backup_target ? {
196
+ '' => $backup_target ? {
197
+ '' => "${fqdn}",
198
+ default => $backup_target,
199
+ },
200
+ default => "$drupal_backup_target",
201
+ }
202
+
203
+ # Frequency of backups
204
+ $backup_frequency = $drupal_backup_frequency ? {
205
+ '' => "daily",
206
+ default => "$drupal_backup_frequency",
207
+ }
208
+
209
+ # If drupal data have to be backed up
210
+ $backup_data_enable = $drupal_backup_data ? {
211
+ '' => $backup_data ? {
212
+ '' => true,
213
+ default => $backup_data,
214
+ },
215
+ default => $drupal_backup_data,
216
+ }
217
+
218
+ # If drupal logs have to be backed up
219
+ $backup_log_enable = $drupal_backup_log ? {
220
+ '' => $backup_log ? {
221
+ '' => true,
222
+ default => $backup_log,
223
+ },
224
+ default => $drupal_backup_log,
225
+ }
226
+
227
+
228
+ ## DEFAULTS FOR FIREWALL CLASS
229
+ # These are settings that influence the (optional) drupal::firewall class
230
+ # You can define these variables or leave the defaults
231
+
232
+ # Source IPs that can access this service - Use iptables friendly format
233
+ $firewall_source_real = $drupal_firewall_source ? {
234
+ '' => $firewall_source ? {
235
+ '' => "0.0.0.0/0",
236
+ default => $firewall_source,
237
+ },
238
+ default => "$drupal_firewall_source",
239
+ }
240
+
241
+ # Destination IP to use for this host (Default facter's $ipaddress)
242
+ $firewall_destination_real = $drupal_firewall_destination ? {
243
+ '' => $firewall_destination ? {
244
+ '' => "${ipaddress}",
245
+ default => $firewall_destination,
246
+ },
247
+ default => "$drupal_firewall_destination",
248
+ }
249
+
250
+ # If firewall filter is enabled
251
+ $firewall_enable = $drupal_firewall_enable ? {
252
+ '' => $firewall_enable ? {
253
+ '' => true,
254
+ default => $firewall_enable,
255
+ },
256
+ default => $drupal_firewall_enable,
257
+ }
258
+
259
+ ## FILE SERVING SOURCE
260
+ # Sets the correct source for static files
261
+ # In order to provide files from different sources without modifying the module
262
+ # you can override the default source path setting the variable $base_source
263
+ # Ex: $base_source="puppet://ip.of.fileserver" or $base_source="puppet://$servername/myprojectmodule"
264
+ # What follows automatically manages the new source standard (with /modules/) from 0.25
265
+
266
+ case $base_source {
267
+ '': {
268
+ $general_base_source = $puppetversion ? {
269
+ /(^0.25)/ => "puppet:///modules",
270
+ /(^0.)/ => "puppet://$servername",
271
+ default => "puppet:///modules",
272
+ }
273
+ }
274
+ default: { $general_base_source=$base_source }
275
+ }
276
+
277
+ }
@@ -0,0 +1,63 @@
1
+ # Define: drupal::site
2
+ #
3
+ # Setup a new Drupal site via drush
4
+ #
5
+ # Variables:
6
+ #
7
+ # Usage:
8
+ #
9
+
10
+ define drupal::site ( url ,
11
+ db_name="" ,
12
+ db_user ,
13
+ db_password ,
14
+ db_host="localhost" ,
15
+ db_type="mysql" ,
16
+ install_mode="no") {
17
+
18
+ $true_install_mode = $install_mode ? {
19
+ true => "yes",
20
+ "on" => "yes",
21
+ "true" => "yes",
22
+ "yes" => "yes",
23
+ default => "no",
24
+ }
25
+
26
+ file { "${drupal::params::sitesdir}/$name":
27
+ mode => $true_install_mode ? {
28
+ "no" => "755" ,
29
+ "yes" => "777" ,
30
+ },
31
+ owner => "root",
32
+ group => "root",
33
+ ensure => directory,
34
+ require => Class["drupal"],
35
+ }
36
+
37
+ case $db_host {
38
+ "localhost","127.0.0.1": {
39
+ include mysql
40
+ mysql::grant { "drupal_grants_${name}":
41
+ mysql_db => "$db_name",
42
+ mysql_user => "$db_user",
43
+ mysql_password => "$db_password",
44
+ mysql_privileges => "SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, LOCK TABLES, CREATE TEMPORARY TABLES",
45
+ mysql_host => "$db_host",
46
+ }
47
+ }
48
+ default: {
49
+ # Attempt to automanage Mysql grants on external servers. TODO: Verify if it works ;-D
50
+ @@mysql::grant { "drupal_grants_${name}":
51
+ mysql_db => "$db_name",
52
+ mysql_user => "$db_user",
53
+ mysql_password => "$db_password",
54
+ mysql_privileges => "SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, LOCK TABLES, CREATE TEMPORARY TABLES",
55
+ mysql_host => "${fqdn}",
56
+ tag => "drupal_grants_${db_host}",
57
+ }
58
+ }
59
+ }
60
+
61
+
62
+ }
63
+
@@ -0,0 +1,33 @@
1
+ # Define: drupal::theme
2
+ #
3
+ # Installs the defined drupal theme via drush
4
+ #
5
+ # Variables:
6
+ # $preferred_state (default="stable") - Define which preferred version state to use
7
+ # $site - Define for which site install the theme (Default:all)
8
+ # $status - Define in what status you want the theme (enable,disable,absent)
9
+ #
10
+ # Usage:
11
+ # drupal::theme { themename: }
12
+ #
13
+ # Example:
14
+ # drupal::theme { "google_analitics": }
15
+ # drupal::theme { "google_analitics": preferred_state => "beta" }
16
+ # drupal::theme { "google_analitics": site => "acme" }
17
+ # drupal::theme { "google_analitics": status => "disable" }
18
+
19
+ define drupal::theme ( preferred_state="stable" , site="all" , status="enable") {
20
+
21
+ exec { "drush-${name}":
22
+ cwd => "${drupal::params::sitesdir}/$site/themes",
23
+ command => $status ? {
24
+ enable => "${drupal::params::drush_path} dl ${name}",
25
+ disable => "${drupal::params::drush_path} dis ${name}",
26
+ absent => "rm -rf ${name}",
27
+ },
28
+ creates => "${drupal::params::sitesdir}/$site/themes/$name",
29
+ require => Class["drupal::drush"],
30
+ }
31
+
32
+ }
33
+
@@ -0,0 +1,62 @@
1
+ # File Managed By Puppet
2
+
3
+ These are the variables used by the module drupal
4
+
5
+ User variables (unfiltered):
6
+ $drupal_version = <%= scope.lookupvar('drupal_version') %>
7
+ $drupal_use_package = <%= scope.lookupvar('drupal_use_package') %>
8
+ $drupal_drush_url = <%= scope.lookupvar('drupal_drush_url') %>
9
+ $drupal_basedir = <%= scope.lookupvar('drupal_basedir') %>
10
+ $drupal_sitesdir = <%= scope.lookupvar('drupal_sitesdir') %>
11
+ $drupal_extra = <%= scope.lookupvar('drupal_extra') %>
12
+
13
+ User variables (after params.pp filter):
14
+ $version = <%= scope.lookupvar('drupal::params::version') %>
15
+ $use_package = <%= scope.lookupvar('drupal::params::use_package') %>
16
+ $drush_url = <%= scope.lookupvar('drupal::params::drush_url') %>
17
+ $basedir = <%= scope.lookupvar('drupal::params::basedir') %>
18
+ $sitesdir = <%= scope.lookupvar('drupal::params::sitesdir') %>
19
+ $extra = <%= scope.lookupvar('drupal::params::extra') %>
20
+
21
+ Extra module variables:
22
+ $drush_path= <%= scope.lookupvar('drupal::params::drush_path') %>
23
+
24
+ General internal variables:
25
+ $packagename = <%= scope.lookupvar('drupal::params::packagename') %>
26
+ $servicename = <%= scope.lookupvar('drupal::params::servicename') %>
27
+ $processname = <%= scope.lookupvar('drupal::params::servicename') %>
28
+ $hasstatus = <%= scope.lookupvar('drupal::params::hasstatus') %>
29
+ $configfile = <%= scope.lookupvar('drupal::params::configfile') %>
30
+ $configfile_mode = <%= scope.lookupvar('drupal::params::configfile_mode') %>
31
+ $configfile_owner = <%= scope.lookupvar('drupal::params::configfile_owner') %>
32
+ $configfile_group = <%= scope.lookupvar('drupal::params::configfile_group') %>
33
+ $configdir = <%= scope.lookupvar('drupal::params::configdir') %>
34
+ $initconfigfile = <%= scope.lookupvar('drupal::params::initconfigfile') %>
35
+ $pidfile = <%= scope.lookupvar('drupal::params::pidfile') %>
36
+ $datadir = <%= scope.lookupvar('drupal::params::datadir') %>
37
+ $logdir = <%= scope.lookupvar('drupal::params::logdir') %>
38
+ $protocol = <%= scope.lookupvar('drupal::params::protocol') %>
39
+ $port = <%= scope.lookupvar('drupal::params::port') %>
40
+
41
+ Variables used by monitor class:
42
+ $monitor_target_real = <%= scope.lookupvar('drupal::params::monitor_target_real') %> ( Set with $drupal_monitor_target )
43
+ $monitor_baseurl_real = <%= scope.lookupvar('drupal::params::monitor_baseurl_real') %> ( Set with $drupal_monitor_baseurl )
44
+ $monitor_url_pattern = <%= scope.lookupvar('drupal::params::monitor_url_pattern') %> ( Set with $drupal_monitor_url_pattern )
45
+ $monitor_port_enable = <%= scope.lookupvar('drupal::params::monitor_port_enable') %> ( Set with $drupal_monitor_port )
46
+ $monitor_url_enable = <%= scope.lookupvar('drupal::params::monitor_url_enable') %> ( Set with $drupal_monitor_url )
47
+ $monitor_process_enable = <%= scope.lookupvar('drupal::params::monitor_process_enable') %> ( Set with $drupal_monitor_process )
48
+ $monitor_plugin_enable = <%= scope.lookupvar('drupal::params::monitor_plugin_enable') %> ( Set with $drupal_monitor_plugin )
49
+
50
+ Variables used by backup class:
51
+ $backup_target_real = <%= scope.lookupvar('drupal::params::backup_target_real') %> ( Set with $drupal_backup_target )
52
+ $backup_frequency = <%= scope.lookupvar('drupal::params::backup_frequency') %> ( Set with $drupal_backup_frequency )
53
+ $backup_data_enable = <%= scope.lookupvar('drupal::params::backup_data_enable') %> ( Set with $drupal_backup_data )
54
+ $backup_log_enable = <%= scope.lookupvar('drupal::params::backup_log_enable') %> ( Set with $drupal_backup_log )
55
+
56
+ Variables used by firewall class:
57
+ $firewall_source_real = <%= scope.lookupvar('drupal::params::firewall_source_real') %> ( Set with $drupal_firewall_source )
58
+ $firewall_destination_real = <%= scope.lookupvar('drupal::params::firewall_destination_real') %> ( Set with $drupal_firewall_destination )
59
+ $firewall_enable = <%= scope.lookupvar('drupal::params::firewall_destination_real') %> ( Set with $drupal_firewall_enable )
60
+
61
+ Module base source for static files:
62
+ $general_base_source = <%= scope.lookupvar('drupal::params::general_base_source') %> ( Set with $base_source )
@@ -0,0 +1 @@
1
+ include drupal::absent
@@ -0,0 +1 @@
1
+ include drupal::backup
@@ -0,0 +1 @@
1
+ include drupal::debug
@@ -0,0 +1 @@
1
+ include drupal::disable
@@ -0,0 +1 @@
1
+ include drupal::disableboot
@@ -0,0 +1 @@
1
+ include drupal::firewall
@@ -0,0 +1 @@
1
+ include drupal
@@ -0,0 +1 @@
1
+ include drupal::monitor
File without changes
@@ -0,0 +1,5 @@
1
+ # Manage here your customizations for /etc/hosts
2
+ #
3
+ class hosts::example42 inherits hosts {
4
+
5
+ }
@@ -0,0 +1,16 @@
1
+ # Class hosts
2
+ #
3
+ # Manages /etc/hosts
4
+ #
5
+ class hosts {
6
+
7
+ file { "hosts":
8
+ ensure => present,
9
+ path => "/etc/hosts",
10
+ content => template("hosts/hosts.erb"),
11
+ }
12
+
13
+ if $my_project { include "hosts::${my_project}" }
14
+
15
+ }
16
+
@@ -0,0 +1,11 @@
1
+ # File Managed by Puppet
2
+ 127.0.0.1 localhost.locadomain localhost
3
+ <%= ipaddress %> <%= fqdn %> <%= hostname %>
4
+
5
+ # The following lines are desirable for IPv6 capable hosts
6
+ ::1 ip6-localhost ip6-loopback
7
+ fe00::0 ip6-localnet
8
+ ff00::0 ip6-mcastprefix
9
+ ff02::1 ip6-allnodes
10
+ ff02::2 ip6-allrouters
11
+ ff02::3 ip6-allhosts
@@ -0,0 +1,4 @@
1
+ # Lab42 Puppet Infrastructure #
2
+ # PROVIDED 'AS IS'
3
+
4
+
@@ -0,0 +1,19 @@
1
+ # Generated by iptables-save v1.3.5 on Tue Jan 29 02:30:29 2008
2
+ *nat
3
+ :PREROUTING ACCEPT [0:0]
4
+ :POSTROUTING ACCEPT [0:0]
5
+ :OUTPUT ACCEPT [1:116]
6
+ COMMIT
7
+ # Completed on Tue Jan 29 02:30:29 2008
8
+ # Generated by iptables-save v1.3.5 on Tue Jan 29 02:30:29 2008
9
+ *filter
10
+ :INPUT DROP [286:21560]
11
+ :FORWARD DROP [0:0]
12
+ :OUTPUT ACCEPT [227:24924]
13
+ -A INPUT -m state --state NEW,RELATED,ESTABLISHED -j ACCEPT
14
+ -A INPUT -i lo -j ACCEPT
15
+ -A INPUT -j LOG --log-prefix "INPUT DROP: "
16
+ -A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT
17
+ -A OUTPUT -m state --state NEW,RELATED,ESTABLISHED -j ACCEPT
18
+ COMMIT
19
+ # Completed on Tue Jan 29 02:30:29 2008
@@ -0,0 +1,15 @@
1
+ # Disables iptables (no boot, no run)
2
+ class iptables::disable {
3
+ case $operatingsystem {
4
+ centos: { include iptables::redhat::disable }
5
+ redhat: { include iptables::redhat::disable }
6
+ default: { err("No such operatingsystem: $operatingsystem yet defined") }
7
+ }
8
+ }
9
+
10
+ class iptables::redhat::disable inherits iptables::redhat {
11
+ Service ["iptables"] {
12
+ ensure => stopped,
13
+ enable => false,
14
+ }
15
+ }
@@ -0,0 +1,9 @@
1
+ class iptables {
2
+
3
+ case $operatingsystem {
4
+ centos: { include iptables::redhat }
5
+ redhat: { include iptables::redhat }
6
+ default: { warning("No such operatingsystem: $operatingsystem yet defined") }
7
+ }
8
+
9
+ }