provizioning 0.8.5 → 0.8.6

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.
@@ -1,3 +1,3 @@
1
1
  module Provizioning
2
- VERSION = "0.8.5"
2
+ VERSION = "0.8.6"
3
3
  end
@@ -0,0 +1,49 @@
1
+ #!/bin/bash
2
+
3
+ ### BEGIN INIT INFO
4
+ # Provides: php-fastcgi
5
+ # Required-Start: $remote_fs $syslog
6
+ # Required-Stop: $remote_fs $syslog
7
+ # Default-Start: 2 3 4 5
8
+ # Default-Stop: 0 1 6
9
+ # Short-Description: Start daemon at boot time
10
+ # Description: Enable service provided by daemon.
11
+ ### END INIT INFO
12
+
13
+
14
+
15
+ if [ `grep -c "nginx" /etc/passwd` = "1" ]; then
16
+ FASTCGI_USER=nginx
17
+ elif [ `grep -c "www-data" /etc/passwd` = "1" ]; then
18
+ FASTCGI_USER=www-data
19
+ elif [ `grep -c "http" /etc/passwd` = "1" ]; then
20
+ FASTCGI_USER=http
21
+ else
22
+ # Set the FASTCGI_USER variable below to the user that
23
+ # you want to run the php-fastcgi processes as
24
+
25
+ FASTCGI_USER=
26
+ fi
27
+
28
+ PHP_SCRIPT=/usr/bin/php-fastcgi
29
+ RETVAL=0
30
+ case "$1" in
31
+ start)
32
+ sudo -u $FASTCGI_USER $PHP_SCRIPT
33
+ RETVAL=$?
34
+ ;;
35
+ stop)
36
+ killall -9 php5-cgi
37
+ RETVAL=$?
38
+ ;;
39
+ restart)
40
+ killall -9 php5-cgi
41
+ sudo -u $FASTCGI_USER $PHP_SCRIPT
42
+ RETVAL=$?
43
+ ;;
44
+ *)
45
+ echo "Usage: php-fastcgi {start|stop|restart}"
46
+ exit 1
47
+ ;;
48
+ esac
49
+ exit $RETVAL
@@ -0,0 +1,16 @@
1
+ #!/bin/sh
2
+
3
+ if [ `grep -c "nginx" /etc/passwd` = "1" ]; then
4
+ FASTCGI_USER=nginx
5
+ elif [ `grep -c "www-data" /etc/passwd` = "1" ]; then
6
+ FASTCGI_USER=www-data
7
+ elif [ `grep -c "http" /etc/passwd` = "1" ]; then
8
+ FASTCGI_USER=http
9
+ else
10
+ # Set the FASTCGI_USER variable below to the user that
11
+ # you want to run the php-fastcgi processes as
12
+
13
+ FASTCGI_USER=
14
+ fi
15
+
16
+ /usr/bin/spawn-fcgi -a 127.0.0.1 -p 9000 -C 6 -u $FASTCGI_USER -f /usr/bin/php5-cgi
@@ -72,6 +72,41 @@ class nginx::fcgi inherits nginx {
72
72
  default => $error_log,
73
73
  }
74
74
 
75
+ $packagelist = ['php5-cgi', 'psmisc', 'spawn-fcgi']
76
+ package { $packagelist:
77
+ ensure => installed,
78
+ }
79
+
80
+ file {"/var/run/php-fastcgi":
81
+ ensure => directory,
82
+ owner => 'www-data', group => 'www-data'
83
+ }
84
+
85
+ file {"/usr/bin/php-fastcgi":
86
+ source => 'puppet:///modules/nginx/php-fastcgi',
87
+ owner => 'root', group => 'root', mode => '0777',
88
+ ensure => present,
89
+ }
90
+
91
+ file {"/etc/init.d/init-php-fastcgi":
92
+ source => 'puppet:///modules/nginx/init-php-fastcgi',
93
+ owner => 'root', group => 'root', mode => '0777',
94
+ ensure => present,
95
+ }
96
+
97
+ service {"init-php-fastcgi":
98
+ ensure => running,
99
+ subscribe => File['/usr/bin/php-fastcgi'],
100
+ enable => true,
101
+ hasstatus => false,
102
+ pattern => '/usr/bin/php5-cgi',
103
+ require => [
104
+ File['/usr/bin/php-fastcgi'],
105
+ File['/etc/init.d/init-php-fastcgi'],
106
+ File['/var/run/php-fastcgi']
107
+ ],
108
+ }
109
+
75
110
  #Autogenerating ssl certs
76
111
  if $listen == '443' and $ensure == 'present' and ( $ssl_certificate == '' or $ssl_certificate_key == '') {
77
112
  exec {"generate-${name}-certs":
@@ -3,226 +3,226 @@
3
3
  # Install nginx.
4
4
  #
5
5
  # Parameters:
6
- # * $nginx_user. Defaults to 'www-data'.
7
- # * $nginx_worker_processes. Defaults to '1'.
8
- # * $nginx_worker_connections. Defaults to '1024'.
6
+ # * $nginx_user. Defaults to 'www-data'.
7
+ # * $nginx_worker_processes. Defaults to '1'.
8
+ # * $nginx_worker_connections. Defaults to '1024'.
9
9
  #
10
10
  # Create config directories :
11
- # * /etc/nginx/conf.d for http config snippet
12
- # * /etc/nginx/includes for sites includes
11
+ # * /etc/nginx/conf.d for http config snippet
12
+ # * /etc/nginx/includes for sites includes
13
13
  #
14
14
  # Provide 3 definitions :
15
- # * nginx::config (http config snippet)
16
- # * nginx::site (http site)
17
- # * nginx::site_include (site includes)
15
+ # * nginx::config (http config snippet)
16
+ # * nginx::site (http site)
17
+ # * nginx::site_include (site includes)
18
18
  #
19
19
  # Templates:
20
- # - nginx.conf.erb => /etc/nginx/nginx.conf
20
+ # - nginx.conf.erb => /etc/nginx/nginx.conf
21
21
  #
22
22
 
23
23
  class nginx {
24
- include "nginx::$operatingsystem"
24
+ include "nginx::$operatingsystem"
25
25
 
26
- $nginx_includes = "/etc/nginx/includes"
27
- $nginx_conf = "/etc/nginx/conf.d"
26
+ $nginx_includes = "/etc/nginx/includes"
27
+ $nginx_conf = "/etc/nginx/conf.d"
28
28
 
29
- $real_nginx_user = $nginx_user ? { '' => 'www-data', default => $nginx_user }
30
- $real_nginx_worker_processes = $nginx_worker_processes ? { '' => '1', default => $nginx_worker_processes }
31
- $real_nginx_worker_connections = $nginx_worker_connections ? { '' => '1024', default => $nginx_worker_connections }
29
+ $real_nginx_user = $nginx_user ? { '' => 'www-data', default => $nginx_user }
30
+ $real_nginx_worker_processes = $nginx_worker_processes ? { '' => '1', default => $nginx_worker_processes }
31
+ $real_nginx_worker_connections = $nginx_worker_connections ? { '' => '1024', default => $nginx_worker_connections }
32
32
 
33
- if ! defined(Package['nginx']) { package { nginx: ensure => installed }}
33
+ if ! defined(Package['nginx']) { package { nginx: ensure => installed }}
34
34
 
35
- service { nginx:
35
+ service { nginx:
36
36
  ensure => running,
37
37
  enable => true,
38
- hasrestart => true,
39
- require => [File["/etc/nginx/nginx.conf"], File["/etc/apt/sources.list.d/nginx.list"]],
40
- }
41
-
42
- class ubuntu {
43
- include apt
44
-
45
- exec {"get-nginx-apt-key":
46
- command => "apt-key adv --keyserver keyserver.ubuntu.com --recv C300EE8C"
47
- }
48
-
49
- file {"/etc/apt/sources.list.d/nginx.list":
50
- ensure => present,
51
- owner => root,
52
- group => root,
53
- content => $operatingsystemrelease ? {
54
- '10.04' => 'deb http://ppa.launchpad.net/nginx/stable/ubuntu lucid main',
55
- '11.04' => 'deb http://ppa.launchpad.net/nginx/stable/ubuntu natty main',
56
- },
57
- require => Exec["get-nginx-apt-key"],
58
- }
59
-
60
- exec {"update apt to find nginx":
61
- command => "/usr/bin/apt-get -y update",
62
- require => File["/etc/apt/sources.list.d/nginx.list"],
63
- }
38
+ hasrestart => true,
39
+ require => [File["/etc/nginx/nginx.conf"], File["/etc/apt/sources.list.d/nginx.list"]],
40
+ }
41
+
42
+ class ubuntu {
43
+ include apt
44
+
45
+ exec {"get-nginx-apt-key":
46
+ command => "apt-key adv --keyserver keyserver.ubuntu.com --recv C300EE8C"
47
+ }
48
+
49
+ file {"/etc/apt/sources.list.d/nginx.list":
50
+ ensure => present,
51
+ owner => root,
52
+ group => root,
53
+ content => $operatingsystemrelease ? {
54
+ '10.04' => 'deb http://ppa.launchpad.net/nginx/stable/ubuntu lucid main',
55
+ '11.04' => 'deb http://ppa.launchpad.net/nginx/stable/ubuntu natty main',
56
+ },
57
+ require => Exec["get-nginx-apt-key"],
58
+ }
59
+
60
+ exec {"update apt to find nginx":
61
+ command => "/usr/bin/apt-get -y update",
62
+ require => File["/etc/apt/sources.list.d/nginx.list"],
63
+ }
64
64
  }
65
65
 
66
66
  file { "/etc/nginx/nginx.conf":
67
- ensure => present,
68
- mode => 644,
69
- owner => root,
70
- group => root,
71
- content => template("nginx/nginx.conf.erb"),
72
- notify => Exec["reload-nginx"],
73
- require => Package["nginx"],
67
+ ensure => present,
68
+ mode => 644,
69
+ owner => root,
70
+ group => root,
71
+ content => template("nginx/nginx.conf.erb"),
72
+ notify => Exec["reload-nginx"],
73
+ require => Package["nginx"],
74
74
  }
75
75
 
76
- file { $nginx_conf:
77
- ensure => directory,
78
- mode => 644,
79
- owner => root,
80
- group => root,
81
- require => Package["nginx"],
82
- }
83
-
84
- file { "/etc/nginx/ssl":
85
- ensure => directory,
86
- mode => 644,
87
- owner => root,
88
- group => root,
89
- require => Package["nginx"],
90
- }
91
-
92
- file { $nginx_includes:
93
- ensure => directory,
94
- mode => 644,
95
- owner => root,
96
- group => root,
97
- require => Package["nginx"],
98
- }
99
-
100
- #Nuke default files
101
- file { "/etc/nginx/fastcgi_params":
102
- ensure => absent,
103
- require => Package["nginx"],
104
- }
105
-
106
-
107
- exec { "reload-nginx":
108
- command => "/etc/init.d/nginx reload",
76
+ file { $nginx_conf:
77
+ ensure => directory,
78
+ mode => 644,
79
+ owner => root,
80
+ group => root,
81
+ require => Package["nginx"],
82
+ }
83
+
84
+ file { "/etc/nginx/ssl":
85
+ ensure => directory,
86
+ mode => 644,
87
+ owner => root,
88
+ group => root,
89
+ require => Package["nginx"],
90
+ }
91
+
92
+ file { $nginx_includes:
93
+ ensure => directory,
94
+ mode => 644,
95
+ owner => root,
96
+ group => root,
97
+ require => Package["nginx"],
98
+ }
99
+
100
+ #Nuke default files
101
+ file { "/etc/nginx/fastcgi_params":
102
+ ensure => absent,
103
+ require => Package["nginx"],
104
+ }
105
+
106
+
107
+ exec { "reload-nginx":
108
+ command => "/etc/init.d/nginx reload",
109
109
  refreshonly => true,
110
110
  }
111
111
 
112
- # Define: nginx::config
113
- #
114
- # Define a nginx config snippet. Places all config snippets into
115
- # /etc/nginx/conf.d, where they will be automatically loaded by http module
116
- #
117
- #
118
- # Parameters :
119
- # * ensure: typically set to "present" or "absent". Defaults to "present"
120
- # * content: set the content of the config snipppet. Defaults to 'template("nginx/${name}.conf.erb")'
121
- # * order: specifies the load order for this config snippet. Defaults to "500"
122
- #
123
- define config ( $ensure = 'present', $content = '', $order="500") {
124
- $real_content = $content ? { '' => template("nginx/${name}.conf.erb"),
125
- default => $content,
126
- }
127
-
128
- file { "${nginx_conf}/${order}-${name}.conf":
129
- ensure => $ensure,
130
- content => $real_content,
131
- mode => 644,
132
- owner => root,
133
- group => root,
134
- notify => Exec["reload-nginx"],
135
- }
112
+ # Define: nginx::config
113
+ #
114
+ # Define a nginx config snippet. Places all config snippets into
115
+ # /etc/nginx/conf.d, where they will be automatically loaded by http module
116
+ #
117
+ #
118
+ # Parameters :
119
+ # * ensure: typically set to "present" or "absent". Defaults to "present"
120
+ # * content: set the content of the config snipppet. Defaults to 'template("nginx/${name}.conf.erb")'
121
+ # * order: specifies the load order for this config snippet. Defaults to "500"
122
+ #
123
+ define config ($ensure = 'present', $content = '', $order="500") {
124
+ $real_content = $content ? { '' => template("nginx/${name}.conf.erb"),
125
+ default => $content,
126
+ }
127
+
128
+ file { "${nginx_conf}/${order}-${name}.conf":
129
+ ensure => $ensure,
130
+ content => $real_content,
131
+ mode => 644,
132
+ owner => root,
133
+ group => root,
134
+ notify => Exec["reload-nginx"],
135
+ }
136
+ }
137
+
138
+ # Define: nginx::site
139
+ #
140
+ # Install a nginx site in /etc/nginx/sites-available (and symlink in /etc/nginx/sites-enabled).
141
+ #
142
+ #
143
+ # Parameters :
144
+ # * ensure: typically set to "present" or "absent". Defaults to "present"
145
+ # * content: site definition (should be a template).
146
+ #
147
+ define site($ensure = 'present', $content = '') {
148
+ case $ensure {
149
+ 'present' : {
150
+ nginx::install_site { $name:
151
+ content => $content
152
+ }
153
+ }
154
+ 'absent' : {
155
+ exec { "rm -f /etc/nginx/sites-enabled/$name":
156
+ onlyif => "/bin/sh -c '[ -L /etc/nginx/sites-enabled/$name ] \\
157
+ && [ /etc/nginx/sites-enabled/$name -ef /etc/nginx/sites-available/$name ]'",
158
+ notify => Exec["reload-nginx"],
159
+ require => Package["nginx"],
160
+ }
161
+ }
162
+ default: { err ( "Unknown ensure value: '$ensure'" ) }
163
+ }
164
+ }
165
+
166
+ # Define: install_site
167
+ #
168
+ # Install nginx vhost
169
+ # This definition is private, not intended to be called directly
170
+ #
171
+ define install_site($content = '' ) {
172
+ # first, make sure the site config exists
173
+ case $content {
174
+ '': {
175
+ file { "/etc/nginx/sites-available/${name}":
176
+ mode => 644,
177
+ owner => root,
178
+ group => root,
179
+ ensure => present,
180
+ alias => "sites-$name",
181
+ require => Package["nginx"],
182
+ notify => Exec["reload-nginx"],
136
183
  }
184
+ }
185
+
186
+ default: {
187
+ file { "/etc/nginx/sites-available/${name}":
188
+ content => $content,
189
+ mode => 644,
190
+ owner => root,
191
+ group => root,
192
+ ensure => present,
193
+ alias => "sites-$name",
194
+ require => Package["nginx"],
195
+ notify => Exec["reload-nginx"],
196
+ }
197
+ }
198
+ }
137
199
 
138
- # Define: nginx::site
139
- #
140
- # Install a nginx site in /etc/nginx/sites-available (and symlink in /etc/nginx/sites-enabled).
141
- #
142
- #
143
- # Parameters :
144
- # * ensure: typically set to "present" or "absent". Defaults to "present"
145
- # * content: site definition (should be a template).
146
- #
147
- define site($ensure = 'present', $content = '') {
148
- case $ensure {
149
- 'present' : {
150
- nginx::install_site { $name:
151
- content => $content
152
- }
153
- }
154
- 'absent' : {
155
- exec { "rm -f /etc/nginx/sites-enabled/$name":
156
- onlyif => "/bin/sh -c '[ -L /etc/nginx/sites-enabled/$name ] \\
157
- && [ /etc/nginx/sites-enabled/$name -ef /etc/nginx/sites-available/$name ]'",
158
- notify => Exec["reload-nginx"],
159
- require => Package["nginx"],
160
- }
161
- }
162
- default: { err ( "Unknown ensure value: '$ensure'" ) }
163
- }
164
- }
165
-
166
- # Define: install_site
167
- #
168
- # Install nginx vhost
169
- # This definition is private, not intended to be called directly
170
- #
171
- define install_site($content = '' ) {
172
- # first, make sure the site config exists
173
- case $content {
174
- '': {
175
- file { "/etc/nginx/sites-available/${name}":
176
- mode => 644,
177
- owner => root,
178
- group => root,
179
- ensure => present,
180
- alias => "sites-$name",
181
- require => Package["nginx"],
182
- notify => Exec["reload-nginx"],
183
- }
184
- }
185
-
186
- default: {
187
- file { "/etc/nginx/sites-available/${name}":
188
- content => $content,
189
- mode => 644,
190
- owner => root,
191
- group => root,
192
- ensure => present,
193
- alias => "sites-$name",
194
- require => Package["nginx"],
195
- notify => Exec["reload-nginx"],
196
- }
197
- }
198
- }
199
-
200
- # now, enable it.
201
- exec { "ln -s /etc/nginx/sites-available/${name} /etc/nginx/sites-enabled/${name}":
202
- unless => "/bin/sh -c '[ -L /etc/nginx/sites-enabled/$name ] \\
200
+ # now, enable it.
201
+ exec { "ln -s /etc/nginx/sites-available/${name} /etc/nginx/sites-enabled/${name}":
202
+ unless => "/bin/sh -c '[ -L /etc/nginx/sites-enabled/$name ] \\
203
203
  && [ /etc/nginx/sites-enabled/$name -ef /etc/nginx/sites-available/$name ]'",
204
- notify => Exec["reload-nginx"],
205
- require => File["sites-$name"],
206
- }
207
- }
208
-
209
- # Define: site_include
210
- #
211
- # Define a site config include in /etc/nginx/includes
212
- #
213
- # Parameters :
214
- # * ensure: typically set to "present" or "absent". Defaults to "present"
215
- # * content: include definition (should be a template).
216
- #
217
- define site_include ( $ensure = 'present', $content = '' ) {
218
- file { "${nginx_includes}/${name}.inc":
219
- content => $content,
220
- mode => 644,
221
- owner => root,
222
- group => root,
223
- ensure => $ensure,
224
- require => File["${nginx_includes}"],
225
- notify => Exec["reload-nginx"],
226
- }
227
- }
204
+ notify => Exec["reload-nginx"],
205
+ require => File["sites-$name"],
206
+ }
207
+ }
208
+
209
+ # Define: site_include
210
+ #
211
+ # Define a site config include in /etc/nginx/includes
212
+ #
213
+ # Parameters :
214
+ # * ensure: typically set to "present" or "absent". Defaults to "present"
215
+ # * content: include definition (should be a template).
216
+ #
217
+ define site_include($ensure = 'present', $content = '') {
218
+ file { "${nginx::nginx_includes}/${name}.inc":
219
+ content => $content,
220
+ mode => 644,
221
+ owner => root,
222
+ group => root,
223
+ ensure => $ensure,
224
+ require => File["${nginx::nginx_includes}"],
225
+ notify => Exec["reload-nginx"],
226
+ }
227
+ }
228
228
  }
@@ -44,11 +44,12 @@ server {
44
44
  # Some modules enforce no slash (/) at the end of the URL
45
45
  # Else this rewrite block wouldn't be needed (GlobalRedirect)
46
46
  rewrite ^/(.*)$ /index.php?q=$1;
47
+ }
47
48
 
48
- location ~ \.php$ {
49
+ location ~ \.php$ {
49
50
  fastcgi_split_path_info ^(.+\.php)(/.+)$;
50
51
  # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
51
- include /etc/nginx/fastcgi_params;
52
+ include /etc/nginx/includes/fastcgi_params.inc;
52
53
  fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
53
54
  fastcgi_intercept_errors on;
54
55
  fastcgi_pass <%= fastcgi_pass %>;
data/puppet/site.pp CHANGED
@@ -1,5 +1,13 @@
1
1
  Exec {
2
- path => "/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin"
2
+ path => [
3
+ '/usr/local/sbin',
4
+ '/usr/local/bin',
5
+ '/opt/local/bin',
6
+ '/usr/bin',
7
+ '/usr/sbin',
8
+ '/bin',
9
+ '/sbin'],
10
+ logoutput => true,
3
11
  }
4
12
 
5
13
  import "classes/*"
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.8.5
4
+ version: 0.8.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-03-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: capistrano
16
- requirement: &70236230682540 !ruby/object:Gem::Requirement
16
+ requirement: &70322742592560 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70236230682540
24
+ version_requirements: *70322742592560
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: capistrano-ext
27
- requirement: &70236230681920 !ruby/object:Gem::Requirement
27
+ requirement: &70322742582000 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70236230681920
35
+ version_requirements: *70322742582000
36
36
  description: Puppet server provisioning tools, recipes and templates
37
37
  email:
38
38
  - victor.castell@season.es
@@ -173,6 +173,8 @@ files:
173
173
  - puppet/modules/mysql/templates/variables_mysql.erb
174
174
  - puppet/modules/network/README
175
175
  - puppet/modules/network/manifests/init.pp
176
+ - puppet/modules/nginx/files/init-php-fastcgi
177
+ - puppet/modules/nginx/files/php-fastcgi
176
178
  - puppet/modules/nginx/manifests/fcgi.pp
177
179
  - puppet/modules/nginx/manifests/init.pp
178
180
  - puppet/modules/nginx/templates/fcgi_drupal_site.erb