OLD | NEW |
1 class nginx ( | 1 class nginx ( |
2 $worker_processes = $nginx::params::worker_processes, | 2 $worker_processes = $nginx::params::worker_processes, |
3 $worker_connections = $nginx::params::worker_connections, | 3 $worker_connections = $nginx::params::worker_connections, |
4 $ssl_session_cache = $nginx::params::ssl_session_cache | 4 $ssl_session_cache = $nginx::params::ssl_session_cache |
5 ) inherits nginx::params { | 5 ) inherits nginx::params { |
6 | 6 |
| 7 apt::ppa {'ppa:nginx/stable': |
| 8 } |
| 9 |
7 apt::source {'nginx': | 10 apt::source {'nginx': |
8 location => "http://nginx.org/packages/ubuntu", | 11 ensure => 'absent', |
9 repos => "nginx", | |
10 key => "7BD9BF62", | |
11 key_source => "http://nginx.org/keys/nginx_signing.key" | |
12 } | 12 } |
13 | 13 |
14 # Ensures that nginx is not installed from the Ubuntu sources | 14 # Ensures that nginx is not installed from the Ubuntu sources |
15 package {'nginx-common': | 15 package {'nginx-common': |
16 ensure => purged, | 16 ensure => purged, |
17 before => Package['nginx'] | 17 before => Package['nginx'] |
18 } | 18 } |
19 | 19 |
20 package {'nginx': | 20 package {'nginx': |
21 ensure => '1.8.0-1~precise', | 21 ensure => '1.8.0-1+precise1', |
22 require => Apt::Source['nginx'] | 22 require => Apt::Ppa['ppa:nginx/stable'], |
23 } | 23 } |
24 | 24 |
25 File { | 25 File { |
26 owner => root, | 26 owner => root, |
27 group => root, | 27 group => root, |
28 mode => 0644, | 28 mode => 0644, |
29 } | 29 } |
30 | 30 |
31 Exec { | 31 Exec { |
32 path => '/usr/bin:/bin', | 32 path => '/usr/bin:/bin', |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 } | 99 } |
100 | 100 |
101 if !defined(File["/etc/nginx/sites-available/${private_key}"]) { | 101 if !defined(File["/etc/nginx/sites-available/${private_key}"]) { |
102 file {"/etc/nginx/sites-available/${private_key}": | 102 file {"/etc/nginx/sites-available/${private_key}": |
103 ensure => absent | 103 ensure => absent |
104 } | 104 } |
105 } | 105 } |
106 } | 106 } |
107 | 107 |
108 if $enabled == true { | 108 if $enabled == true { |
| 109 |
| 110 if $is_default { |
| 111 $default_conf = '/etc/nginx/sites-enabled/default' |
| 112 ensure_resource('file', $default_conf, {ensure => 'absent'}) |
| 113 File[$default_conf] ~> Service['nginx'] |
| 114 } |
| 115 |
109 file {"/etc/nginx/sites-enabled/${domain}": | 116 file {"/etc/nginx/sites-enabled/${domain}": |
110 ensure => link, | 117 ensure => link, |
111 require => File["/etc/nginx/sites-available/${domain}"], | 118 require => File["/etc/nginx/sites-available/${domain}"], |
112 target => "/etc/nginx/sites-available/${domain}", | 119 target => "/etc/nginx/sites-available/${domain}", |
113 notify => Service['nginx'] | 120 notify => Service['nginx'] |
114 } | 121 } |
115 } | 122 } |
116 | 123 |
117 file {"/etc/logrotate.d/nginx_$domain": | 124 file {"/etc/logrotate.d/nginx_$domain": |
118 ensure => file, | 125 ensure => file, |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 } | 171 } |
165 | 172 |
166 service {'nginx': | 173 service {'nginx': |
167 ensure => running, | 174 ensure => running, |
168 enable => true, | 175 enable => true, |
169 restart => '/etc/init.d/nginx reload', | 176 restart => '/etc/init.d/nginx reload', |
170 hasstatus => true, | 177 hasstatus => true, |
171 require => File['/etc/nginx/nginx.conf'] | 178 require => File['/etc/nginx/nginx.conf'] |
172 } | 179 } |
173 } | 180 } |
OLD | NEW |