Left: | ||
Right: |
LEFT | RIGHT |
---|---|
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 $geoip_country = undef, | 5 $geoip_country = undef, |
6 $geoip_city = undef, | 6 $geoip_city = undef, |
7 ) inherits nginx::params { | 7 ) inherits nginx::params { |
8 | 8 |
9 apt::ppa {'ppa:nginx/stable': | 9 apt::ppa {'ppa:nginx/stable': |
10 } | 10 } |
(...skipping 28 matching lines...) Expand all Loading... | |
39 } | 39 } |
40 | 40 |
41 Exec { | 41 Exec { |
42 path => '/usr/bin:/bin', | 42 path => '/usr/bin:/bin', |
43 logoutput => 'on_failure', | 43 logoutput => 'on_failure', |
44 } | 44 } |
45 | 45 |
46 | 46 |
47 file {'/etc/nginx/nginx.conf': | 47 file {'/etc/nginx/nginx.conf': |
48 content => template('nginx/nginx.conf.erb'), | 48 content => template('nginx/nginx.conf.erb'), |
49 require => Package['nginx'], | 49 require => Package['nginx'], |
Wladimir Palant
2016/05/27 11:15:08
If I see it correctly, you replaced notify here by
mathias
2016/05/27 11:43:53
Beside the notify for the service in this section
Wladimir Palant
2016/05/27 12:33:01
Well, you require the package now - it should inst
mathias
2016/05/27 14:16:16
I do forgive you, but again this is not the full p
Wladimir Palant
2016/05/27 14:41:34
You are free to remove unrelated changes from this
| |
50 notify => Service['nginx'] | |
50 } | 51 } |
51 | 52 |
52 file {'/etc/nginx/sites-available': | 53 file {'/etc/nginx/sites-available': |
53 ensure => directory, | 54 ensure => directory, |
54 require => Package['nginx'] | 55 require => Package['nginx'] |
55 } | 56 } |
56 | 57 |
57 file {'/etc/nginx/sites-enabled': | 58 file {'/etc/nginx/sites-enabled': |
58 ensure => directory, | 59 ensure => directory, |
59 require => Package['nginx'] | 60 require => Package['nginx'] |
60 } | 61 } |
61 | 62 |
62 file {'/var/cache/nginx': | 63 file {'/var/cache/nginx': |
63 before => Service['nginx'], | 64 before => Service['nginx'], |
64 ensure => directory, | 65 ensure => directory, |
65 require => Package['nginx'], | 66 require => Package['nginx'], |
67 } | |
68 | |
69 @file {'/etc/nginx/dhparam.pem': | |
70 ensure => 'present', | |
71 mode => 0600, | |
72 notify => Service['nginx'], | |
73 require => Package['nginx'], | |
74 source => 'puppet:///modules/private/dhe_rsa_export.pem', | |
66 } | 75 } |
67 | 76 |
68 define hostconfig ( | 77 define hostconfig ( |
69 $domain = $title, | 78 $domain = $title, |
70 $alt_names = [], | 79 $alt_names = [], |
71 $log, | 80 $log, |
72 $log_format = 'main', | 81 $log_format = 'main', |
73 $is_default = false, | 82 $is_default = false, |
74 $source = undef, | 83 $source = undef, |
75 $content = undef, | 84 $content = undef, |
76 $global_config = undef, | 85 $global_config = undef, |
77 $certificate = undef, | 86 $certificate = undef, |
78 $private_key = undef, | 87 $private_key = undef, |
79 $enabled = true) { | 88 $enabled = true) { |
80 file {"/etc/nginx/sites-available/${domain}": | 89 file {"/etc/nginx/sites-available/${domain}": |
81 ensure => file, | 90 ensure => file, |
82 content => template('nginx/site.erb'), | 91 content => template('nginx/site.erb'), |
83 require => Package['nginx'], | 92 require => Package['nginx'], |
84 notify => Service['nginx'], | 93 notify => Service['nginx'], |
85 } | 94 } |
86 | 95 |
87 if $certificate and $private_key { | 96 if $certificate and $private_key { |
97 realize(File['/etc/nginx/dhparam.pem']) | |
98 | |
88 if !defined(File["/etc/nginx/${certificate}"]) { | 99 if !defined(File["/etc/nginx/${certificate}"]) { |
89 file {"/etc/nginx/${certificate}": | 100 file {"/etc/nginx/${certificate}": |
90 ensure => file, | 101 ensure => file, |
91 mode => 0400, | 102 mode => 0400, |
92 notify => Service['nginx'], | 103 notify => Service['nginx'], |
93 before => File["/etc/nginx/sites-available/${domain}"], | 104 before => File["/etc/nginx/sites-available/${domain}"], |
94 require => Package['nginx'], | 105 require => Package['nginx'], |
95 source => "puppet:///modules/private/${certificate}" | 106 source => "puppet:///modules/private/${certificate}" |
96 } | 107 } |
97 } | 108 } |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
178 | 189 |
179 $find_chmod_base = [$find_cmd_base, '-not', '-perm', '0640'] | 190 $find_chmod_base = [$find_cmd_base, '-not', '-perm', '0640'] |
180 $find_chmod_exec = ['-ls', '-exec', 'chmod', '0640', '{}', ';'] | 191 $find_chmod_exec = ['-ls', '-exec', 'chmod', '0640', '{}', ';'] |
181 | 192 |
182 exec {"set_logfiles_permissions": | 193 exec {"set_logfiles_permissions": |
183 command => shellquote($find_chmod_base, $find_chmod_exec), | 194 command => shellquote($find_chmod_base, $find_chmod_exec), |
184 unless => shellquote($find_chmod_base, $find_kill_exec), | 195 unless => shellquote($find_chmod_base, $find_kill_exec), |
185 subscribe => Service['nginx'], | 196 subscribe => Service['nginx'], |
186 } | 197 } |
187 | 198 |
199 $restart_command = join([ | |
200 'set -e', | |
201 'pid=`cat /var/run/nginx.pid`', | |
202 'kill -USR2 "$pid"', | |
203 'sleep 2', | |
204 'kill -QUIT "$pid"', | |
205 ], "\n") | |
206 | |
188 service {'nginx': | 207 service {'nginx': |
189 ensure => running, | 208 ensure => running, |
190 enable => true, | 209 enable => true, |
191 hasrestart => true, | 210 restart => $restart_command, |
Wladimir Palant
2016/05/27 11:15:08
Do I see it correctly that we will now restart Ngi
mathias
2016/05/27 11:43:53
No, not with Puppet, at least not without a custom
Wladimir Palant
2016/05/27 12:33:01
That's not how I think it works - the original pro
mathias
2016/05/27 14:16:16
Using the restart parameter for this approach is n
Wladimir Palant
2016/05/27 14:41:34
Thank you.
| |
192 hasstatus => true, | 211 hasstatus => true, |
193 require => Package['nginx'], | 212 require => Package['nginx'], |
194 subscribe => File['/etc/nginx/nginx.conf'], | |
195 } | 213 } |
196 | 214 |
197 file {'/usr/share/nginx/html/50x.html': | 215 file {'/usr/share/nginx/html/50x.html': |
198 mode => 0644, | 216 mode => 0644, |
199 owner => 'root', | 217 owner => 'root', |
200 require => Package['nginx'], | 218 require => Package['nginx'], |
201 source => 'puppet:///modules/nginx/50x.html', | 219 source => 'puppet:///modules/nginx/50x.html', |
202 } | 220 } |
203 } | 221 } |
LEFT | RIGHT |