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,75 @@
1
+ #
2
+ # This is the Apache server configuration file providing SSL support.
3
+ # It contains the configuration directives to instruct the server how to
4
+ # serve pages over an https connection. For detailing information about these
5
+ # directives see <URL:http://httpd.apache.org/docs/2.2/mod/mod_ssl.html>
6
+ #
7
+ # Do NOT simply read the instructions in here without understanding
8
+ # what they do. They're here only as hints or reminders. If you are unsure
9
+ # consult the online docs. You have been warned.
10
+ #
11
+
12
+ LoadModule ssl_module modules/mod_ssl.so
13
+
14
+ #
15
+ # When we also provide SSL we have to listen to the
16
+ # the HTTPS port in addition.
17
+ #
18
+ Listen 443
19
+
20
+ ##
21
+ ## SSL Global Context
22
+ ##
23
+ ## All SSL configuration in this context applies both to
24
+ ## the main server and all SSL-enabled virtual hosts.
25
+ ##
26
+
27
+ #
28
+ # Some MIME-types for downloading Certificates and CRLs
29
+ #
30
+ AddType application/x-x509-ca-cert .crt
31
+ AddType application/x-pkcs7-crl .crl
32
+
33
+ # Pass Phrase Dialog:
34
+ # Configure the pass phrase gathering process.
35
+ # The filtering dialog program (`builtin' is a internal
36
+ # terminal dialog) has to provide the pass phrase on stdout.
37
+ SSLPassPhraseDialog builtin
38
+
39
+ # Inter-Process Session Cache:
40
+ # Configure the SSL Session Cache: First the mechanism
41
+ # to use and second the expiring timeout (in seconds).
42
+ #SSLSessionCache dc:UNIX:/var/cache/mod_ssl/distcache
43
+ SSLSessionCache shmcb:/var/cache/mod_ssl/scache(512000)
44
+ SSLSessionCacheTimeout 300
45
+
46
+ # Semaphore:
47
+ # Configure the path to the mutual exclusion semaphore the
48
+ # SSL engine uses internally for inter-process synchronization.
49
+ SSLMutex default
50
+
51
+ # Pseudo Random Number Generator (PRNG):
52
+ # Configure one or more sources to seed the PRNG of the
53
+ # SSL library. The seed data should be of good random quality.
54
+ # WARNING! On some platforms /dev/random blocks if not enough entropy
55
+ # is available. This means you then cannot use the /dev/random device
56
+ # because it would lead to very long connection times (as long as
57
+ # it requires to make more entropy available). But usually those
58
+ # platforms additionally provide a /dev/urandom device which doesn't
59
+ # block. So, if available, use this one instead. Read the mod_ssl User
60
+ # Manual for more details.
61
+ SSLRandomSeed startup file:/dev/urandom 256
62
+ SSLRandomSeed connect builtin
63
+ #SSLRandomSeed startup file:/dev/random 512
64
+ #SSLRandomSeed connect file:/dev/random 512
65
+ #SSLRandomSeed connect file:/dev/urandom 512
66
+
67
+ #
68
+ # Use "SSLCryptoDevice" to enable any supported hardware
69
+ # accelerators. Use "openssl engine -v" to list supported
70
+ # engine names. NOTE: If you enable an accelerator and the
71
+ # server does not start, consult the error logs and ensure
72
+ # your accelerator is functioning properly.
73
+ #
74
+ SSLCryptoDevice builtin
75
+ #SSLCryptoDevice ubsec
@@ -0,0 +1,152 @@
1
+ class apache {
2
+
3
+ include "apache::$operatingsystem"
4
+
5
+ $package_name = $operatingsystem ? {
6
+ centos => httpd,
7
+ default => apache2
8
+ }
9
+
10
+ $development_package_name = $operatingsystem ? {
11
+ centos => httpd-devel,
12
+ default => apache2-threaded-dev
13
+ }
14
+
15
+ $apache_user = $operatingsystem ? {
16
+ centos => "apache",
17
+ default => "www-data"
18
+ }
19
+
20
+ user { $apache_user:
21
+ groups => application,
22
+ require => [Package[httpd], Class["base::application"]],
23
+ notify => Service[httpd]
24
+ }
25
+
26
+ define host($content, $ensure = enabled) {
27
+ include apache
28
+
29
+ file { $name:
30
+ path => "/etc/$apache::package_name/sites-available/$name",
31
+ owner => root,
32
+ group => root,
33
+ mode => 644,
34
+ content => $content,
35
+ require => Package[httpd],
36
+ notify => Service[httpd]
37
+ }
38
+
39
+ case $ensure {
40
+ default : { err ( "unknown ensure value '${ensure}', should be either enabled or disabled" ) }
41
+
42
+ enabled: {
43
+ file { "/etc/$apache::package_name/sites-enabled/$name":
44
+ require => File[$name],
45
+ ensure => "/etc/$apache::package_name/sites-available/$name",
46
+ notify => Service[httpd]
47
+ }
48
+ }
49
+
50
+ disabled: {
51
+ file { "/etc/$apache::package_name/sites-enabled/$name":
52
+ require => File[$name],
53
+ ensure => absent,
54
+ notify => Service[httpd]
55
+ }
56
+ }
57
+ }
58
+ }
59
+
60
+ package { $package_name :
61
+ ensure => present,
62
+ alias => httpd
63
+ }
64
+
65
+ package { $development_package_name:
66
+ ensure => present,
67
+ alias => httpd-devel,
68
+ require => Package[$package_name]
69
+ }
70
+
71
+ service { $package_name:
72
+ ensure => running,
73
+ alias => httpd,
74
+ require => [Package[$package_name]]
75
+ }
76
+
77
+ class base {
78
+ # common stuff
79
+ }
80
+
81
+ class ubuntu inherits apache::base {
82
+
83
+ define module($ensure = 'present') {
84
+ case $ensure {
85
+ present,installed : {
86
+ exec { "/usr/sbin/a2enmod $name":
87
+ creates => "/etc/apache2/mods-enabled/${name}.load",
88
+ require => Package[apache2],
89
+ notify => Service[apache2]
90
+ }
91
+ }
92
+ absent,purged: {
93
+ exec { "/usr/sbin/a2dismod $name":
94
+ onlyif => "/usr/bin/test -L /etc/apache2/mods-enabled/${name}.load",
95
+ require => Package[apache2],
96
+ notify => Service[apache2]
97
+ }
98
+ }
99
+ default: { err ( "apache::ubuntu::module Unknown ensure value: '$ensure'" ) }
100
+ }
101
+ }
102
+
103
+ module { "rewrite": ensure => present }
104
+ module { "ssl": ensure => present }
105
+ module { "expires": ensure => present }
106
+ module { "deflate": ensure => present }
107
+ module { "headers": ensure => present }
108
+ }
109
+
110
+ class centos inherits apache::base {
111
+
112
+ package { "mod_ssl":
113
+ ensure => present
114
+ }
115
+
116
+ file { "/etc/httpd/conf.d/ssl.conf":
117
+ content => template("apache/ssl.conf"),
118
+ ensure => present,
119
+ require => Package["mod_ssl"],
120
+ owner => root,
121
+ group => root
122
+ }
123
+
124
+ service { "httpd":
125
+ ensure => running,
126
+ require => [Package[httpd], File["/etc/httpd/sites-enabled"]],
127
+ subscribe => [File["/etc/httpd/conf/httpd.conf"], File["/etc/httpd/conf.d/ssl.conf"]],
128
+ }
129
+
130
+ file { "/etc/httpd/conf/httpd.conf":
131
+ content => template("apache/centos.conf"),
132
+ owner => root,
133
+ group => root,
134
+ require => Package[httpd]
135
+ }
136
+
137
+ file { "/etc/httpd/sites-available":
138
+ ensure => directory,
139
+ owner => root,
140
+ group => root,
141
+ require => Package[httpd]
142
+ }
143
+
144
+ file { "/etc/httpd/sites-enabled":
145
+ ensure => directory,
146
+ owner => root,
147
+ group => root,
148
+ require => Package[httpd]
149
+ }
150
+ }
151
+
152
+ }
@@ -0,0 +1,5 @@
1
+ class apt {
2
+ exec {"apt-get update":
3
+ command => "/usr/bin/apt-get -y update"
4
+ }
5
+ }
@@ -0,0 +1,13 @@
1
+ # Have had to remove dropping to ntp user, as Kernel supplied by O2 doesn't support it.
2
+ # See: http://www.linuxquestions.org/questions/linux-software-2/ntp-error-failed-to-drop-root-privileges-812256/
3
+
4
+ # # Drop root to id 'ntp:ntp' by default.
5
+ # OPTIONS="-u ntp:ntp -p /var/run/ntpd.pid"
6
+
7
+ OPTIONS="-p /var/run/ntpd.pid"
8
+
9
+ # Set to 'yes' to sync hw clock after successful ntpdate
10
+ SYNC_HWCLOCK=no
11
+
12
+ # Additional options for ntpdate
13
+ NTPDATE_OPTIONS=""
@@ -0,0 +1,79 @@
1
+ stage { "pre-flight": before => Stage[main] }
2
+ class { "base": stage => "pre-flight" }
3
+
4
+ class base {
5
+ include base::time
6
+ include base::application
7
+
8
+ $packagelist = ['git-core', 'vim', 'screen']
9
+ package { $packagelist:
10
+ ensure => installed
11
+ }
12
+
13
+ host { "$hostname.lan" :
14
+ ensure => present,
15
+ host_aliases => $hostname,
16
+ ip => "127.0.0.1"
17
+ }
18
+
19
+ host { "localhost" :
20
+ ensure => present,
21
+ ip => "127.0.0.1"
22
+ }
23
+
24
+ package {"tcpdump":
25
+ ensure => present
26
+ }
27
+
28
+ class time {
29
+ file { "/etc/localtime":
30
+ source => "/usr/share/zoneinfo/Europe/London"
31
+ }
32
+
33
+ package { "ntp":
34
+ ensure => present
35
+ }
36
+
37
+ service { "ntp":
38
+ ensure => running,
39
+ require => Package["ntp"]
40
+ }
41
+
42
+ case $operatingsystem {
43
+ "CentOS": {
44
+ file {"/etc/sysconfig/ntpd":
45
+ content => template("base/ntp/ntpd-sysconfig")
46
+ }
47
+ }
48
+
49
+ "Debian": {
50
+ # todo
51
+ }
52
+ }
53
+ }
54
+
55
+ class application {
56
+ user { "application":
57
+ shell => "/bin/false"
58
+ }
59
+
60
+ file { "/var/apps":
61
+ ensure => directory,
62
+ owner => root,
63
+ group => application,
64
+ require => [User[application]],
65
+ mode => 771
66
+ }
67
+ }
68
+
69
+ define set_hostname($hostname) {
70
+ exec { "hostname":
71
+ command => "hostname ${hostname}",
72
+ unless => "test `hostname` = '$hostname'"
73
+ }
74
+
75
+ file { "/etc/hostname":
76
+ content => $hostname
77
+ }
78
+ }
79
+ }
@@ -0,0 +1,53 @@
1
+ class freerange {
2
+ include zsh
3
+
4
+ user_without_ssh_key {"freerange":
5
+ user => "freerange"
6
+ }
7
+
8
+ define user($user, $key, $key_type="ssh-rsa", $shell="/bin/bash") {
9
+ user_without_ssh_key { $name:
10
+ user => $user,
11
+ shell => $shell
12
+ }
13
+ append_ssh_key_to_user { $name:
14
+ user => $user,
15
+ key => $key,
16
+ key_type => $key_type
17
+ }
18
+ append_ssh_key_to_user { "freerange-$name":
19
+ user => "freerange",
20
+ key => $key,
21
+ key_type => $key_type,
22
+ require => User["freerange"]
23
+ }
24
+ }
25
+
26
+ define user_without_ssh_key($user, $shell="/bin/bash") {
27
+ include base::application
28
+
29
+ user {$user:
30
+ gid => "application",
31
+ require => User[application],
32
+ shell => $shell
33
+ }
34
+
35
+ file { "/home/$user":
36
+ ensure => directory,
37
+ owner => $user,
38
+ group => application,
39
+ require => User[$user]
40
+ }
41
+ }
42
+
43
+ define append_ssh_key_to_user($user, $key, $key_type="ssh-rsa") {
44
+ ssh_authorized_key { $name:
45
+ ensure => present,
46
+ user => $user,
47
+ key => $key,
48
+ name => $name,
49
+ type => $key_type,
50
+ require => File["/home/$user"]
51
+ }
52
+ }
53
+ }
@@ -0,0 +1,9 @@
1
+ ---
2
+ :bulk_threshold: 1000
3
+ :verbose: true
4
+ :benchmark: false
5
+ :update_sources: true
6
+ :backtrace: false
7
+ :sources:
8
+ - http://gemcutter.org/
9
+ gem: --no-ri --no-rdoc
@@ -0,0 +1,10 @@
1
+ # Ruby should already be installed, so this class just adds to the ruby environment]
2
+ # by adding bundler, etc.
3
+
4
+ class gemrc {
5
+ file { "/root/.gemrc":
6
+ content => template("gemrc/gemrc"),
7
+ owner => root,
8
+ group => root
9
+ }
10
+ }
@@ -0,0 +1,19 @@
1
+ #
2
+ # Class: imagemagick
3
+ #
4
+ # Include it to install and imagemagick
5
+ # It defines package.
6
+ #
7
+ # Usage:
8
+ # include imagemagick
9
+ #
10
+
11
+ class imagemagick {
12
+ package{ "imagemagick":
13
+ ensure => installed,
14
+ }
15
+
16
+ package{ "libmagickwand-dev":
17
+ ensure => installed,
18
+ }
19
+ }
@@ -0,0 +1,3 @@
1
+ #!/bin/sh
2
+ iptables-restore < /etc/iptables.rules
3
+ exit 0
@@ -0,0 +1,2 @@
1
+ -A INPUT -m limit --limit 5/min -j LOG --log-prefix "iptables denied: " --log-level 7
2
+ -A INPUT -j DROP
@@ -0,0 +1,2 @@
1
+ -A INPUT -i lo -j ACCEPT
2
+ -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
@@ -0,0 +1,59 @@
1
+ import "iptables"
2
+
3
+ class config_iptables {
4
+
5
+ iptables { "http":
6
+ proto => "tcp",
7
+ dport => "80",
8
+ jump => "ACCEPT",
9
+ require => [File["/etc/puppet/iptables/pre.iptables"], File["/etc/puppet/iptables/post.iptables"]],
10
+ notify => Exec["save iptables rules"]
11
+ }
12
+
13
+ iptables { "https":
14
+ proto => "tcp",
15
+ dport => "443",
16
+ jump => "ACCEPT",
17
+ require => [File["/etc/puppet/iptables/pre.iptables"], File["/etc/puppet/iptables/post.iptables"]],
18
+ notify => Exec["save iptables rules"]
19
+ }
20
+
21
+ iptables { "ssh":
22
+ proto => "tcp",
23
+ dport => "22",
24
+ jump => "ACCEPT",
25
+ require => [File["/etc/puppet/iptables/pre.iptables"], File["/etc/puppet/iptables/post.iptables"]],
26
+ notify => Exec["save iptables rules"]
27
+ }
28
+
29
+ exec { "save iptables rules":
30
+ command => "iptables-save > /etc/iptables.rules",
31
+ refreshonly => true,
32
+ require => File["/etc/network/if-pre-up.d/load-iptables"]
33
+ }
34
+
35
+ file { "/etc/network/if-pre-up.d/load-iptables":
36
+ content => template("iptables/load-iptables"),
37
+ owner => root,
38
+ group => root,
39
+ mode => 700
40
+ }
41
+
42
+ file { "/etc/puppet/iptables/pre.iptables":
43
+ content => template("iptables/pre-iptables"),
44
+ owner => root,
45
+ group => root,
46
+ require => File["/etc/puppet/iptables"]
47
+ }
48
+
49
+ file { "/etc/puppet/iptables/post.iptables":
50
+ content => template("iptables/post-iptables"),
51
+ owner => root,
52
+ group => root,
53
+ require => File["/etc/puppet/iptables"]
54
+ }
55
+
56
+ file { "/etc/puppet/iptables":
57
+ ensure => directory
58
+ }
59
+ }
@@ -0,0 +1,15 @@
1
+ <%= log %> {
2
+ <% options.each do |opt| -%>
3
+ <%= opt %>
4
+ <% end -%>
5
+ <% if prerotate != "NONE" -%>
6
+ prerotate
7
+ <%= prerotate %>
8
+ endscript
9
+ <% end -%>
10
+ <% if postrotate != "NONE" -%>
11
+ postrotate
12
+ <%= postrotate %>
13
+ endscript
14
+ <% end -%>
15
+ }
@@ -0,0 +1,37 @@
1
+ class logrotate {
2
+ package { "logrotate":
3
+ ensure => installed
4
+ }
5
+
6
+ file { "/etc/logrotate.d":
7
+ ensure => directory,
8
+ owner => root,
9
+ group => root,
10
+ mode => 755,
11
+ require => Package["logrotate"]
12
+ }
13
+
14
+ define rotate_file($source = false, $log = false, $options = false, $prerotate="NONE", $postrotate="NONE") {
15
+ # $options should be an array containing 1 or more logrotate directives (e.g. missingok, compress)
16
+ include logrotate
17
+
18
+ if $source {
19
+ file { "/etc/logrotate.d/${name}":
20
+ owner => root,
21
+ group => root,
22
+ mode => 644,
23
+ source => $source,
24
+ require => File["/etc/logrotate.d"]
25
+ }
26
+ } else {
27
+ file { "/etc/logrotate.d/${name}":
28
+ owner => root,
29
+ group => root,
30
+ mode => 644,
31
+ content => template("logrotate/logrotate.erb"),
32
+ require => File["/etc/logrotate.d"]
33
+ }
34
+ }
35
+ }
36
+ }
37
+
@@ -0,0 +1,89 @@
1
+ # mongodb.conf
2
+
3
+ # Where to store the data.
4
+
5
+ # Note: if you run mongodb as a non-root user (recommended) you may
6
+ # need to create and set permissions for this directory manually,
7
+ # e.g., if the parent directory isn't mutable by the mongodb user.
8
+ dbpath=/var/lib/mongodb
9
+
10
+ #where to log
11
+ logpath=/var/log/mongodb/mongodb.log
12
+
13
+ logappend=true
14
+
15
+ #port = 27017
16
+
17
+ # enable Journaling
18
+ journal = true
19
+
20
+ # Enables periodic logging of CPU utilization and I/O wait
21
+ #cpu = true
22
+
23
+ # Turn on/off security. Off is currently the default
24
+ #noauth = true
25
+ #auth = true
26
+
27
+ # Verbose logging output.
28
+ #verbose = true
29
+
30
+ # Inspect all client data for validity on receipt (useful for
31
+ # developing drivers)
32
+ #objcheck = true
33
+
34
+ # Enable db quota management
35
+ #quota = true
36
+
37
+ # Set oplogging level where n is
38
+ # 0=off (default)
39
+ # 1=W
40
+ # 2=R
41
+ # 3=both
42
+ # 7=W+some reads
43
+ #diaglog = 0
44
+
45
+ # Diagnostic/debugging option
46
+ #nocursors = true
47
+
48
+ # Ignore query hints
49
+ #nohints = true
50
+
51
+ # Disable the HTTP interface (Defaults to localhost:27018).
52
+ #nohttpinterface = true
53
+
54
+ # Turns off server-side scripting. This will result in greatly limited
55
+ # functionality
56
+ #noscripting = true
57
+
58
+ # Turns off table scans. Any query that would do a table scan fails.
59
+ #notablescan = true
60
+
61
+ # Disable data file preallocation.
62
+ #noprealloc = true
63
+
64
+ # Specify .ns file size for new databases.
65
+ # nssize = <size>
66
+
67
+ # Accout token for Mongo monitoring server.
68
+ #mms-token = <token>
69
+
70
+ # Server name for Mongo monitoring server.
71
+ #mms-name = <server-name>
72
+
73
+ # Ping interval for Mongo monitoring server.
74
+ #mms-interval = <seconds>
75
+
76
+ # Replication Options
77
+
78
+ # in master/slave replicated mongo databases, specify here whether
79
+ # this is a slave or master
80
+ #slave = true
81
+ #source = master.example.com
82
+ # Slave only: specify a single database to replicate
83
+ #only = master.example.com
84
+ # or
85
+ #master = true
86
+ #source = slave.example.com
87
+
88
+ # in replica set configuration, specify the name of the replica set
89
+ # replSet = setname