puppet-standalone-mashup/shared/additional-modules/nginx/manifests/init.pp

78 lines
1.9 KiB
ObjectPascal
Raw Normal View History

2012-02-28 20:07:55 +00:00
class nginx($version, $max_pool_size = 20) {
2012-01-31 03:14:25 +00:00
gem { 'passenger':
version => $version,
path => "${ruby::with_ruby_path}",
require => Build_and_install['ruby'],
ensure => present
}
$install_path = install_path($name, $version)
$symlink_path = symlink_path($name)
exec { 'install-passenger':
command => "passenger-install-nginx-module --auto --auto-download --prefix=${install_path}",
path => $ruby::with_ruby_path,
require => Gem['passenger'],
unless => "test -d ${install_path}",
timeout => 0,
logoutput => on_failure
}
$pid_file = pid_path($name)
$sbin_path = sbin_path($name)
$config_file = "${base::config_path}/nginx.conf"
$config_path = "${base::config_path}/nginx"
2012-04-25 22:14:41 +00:00
$nginx_start = "${sbin_path}/nginx -c ${config_file}"
$nginx_stop = "${sbin_path}/nginx -s stop -c ${config_file}"
2012-01-31 03:14:25 +00:00
god_init { $name:
2012-04-25 22:14:41 +00:00
start => $nginx_start,
stop => $nginx_stop,
restart => "${nginx_stop} ; ${nginx_start}",
2012-01-31 03:14:25 +00:00
pid_file => $pid_file,
ensure => present,
require => Exec['install-passenger']
}
2012-02-14 12:11:25 +00:00
file { $config_path:
2012-01-31 03:14:25 +00:00
ensure => directory,
before => God_init[$name]
}
file { [ "${config_path}/sites-available", "${config_path}/sites-enabled" ]:
ensure => directory,
require => File[$config_path],
}
file { $config_file:
content => template('nginx/nginx.conf'),
before => God_init[$name]
}
file { "${config_path}/fastcgi.conf":
content => template('nginx/fastcgi.conf'),
2012-02-28 20:07:55 +00:00
mode => 644,
2012-01-31 03:14:25 +00:00
require => File[$config_file]
}
file { "${config_path}/fastcgi_params":
content => template('nginx/fastcgi_params'),
2012-02-28 20:07:55 +00:00
mode => 644,
2012-01-31 03:14:25 +00:00
require => File[$config_file]
}
2012-04-25 22:14:41 +00:00
file { '/var/www':
ensure => directory,
group => web,
mode => 2775,
require => Group['web']
}
2012-01-31 03:14:25 +00:00
2012-02-28 20:07:55 +00:00
file { $symlink_path:
ensure => $install_path,
require => Exec['install-passenger']
}
2012-01-31 03:14:25 +00:00
}