| 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': | 7 apt::ppa {'ppa:nginx/stable': |
| 8 } | 8 } |
| 9 | 9 |
| 10 apt::source {'nginx': | 10 apt::source {'nginx': |
| 11 ensure => 'absent', | 11 ensure => 'absent', |
| 12 } | 12 } |
| 13 | 13 |
| 14 # Ensures that nginx is not installed from the Ubuntu sources | 14 exec {'purge-nginx': |
| 15 package {'nginx-common': | 15 command => '/usr/bin/apt-get -y purge nginx', |
| 16 ensure => purged, | 16 logoutput => true, |
| 17 before => Package['nginx'] | 17 path => '/usr/sbin:/usr/bin:/sbin:/bin', |
| 18 refreshonly => true, |
| 19 returns => [0, 100], |
| 20 subscribe => Apt::Ppa['ppa:nginx/stable'], |
| 18 } | 21 } |
| 19 | 22 |
| 20 package {'nginx': | 23 package {'nginx': |
| 21 ensure => '1.8.0-1+precise1', | 24 ensure => '1.8.0-1+precise1', |
| 22 require => Apt::Ppa['ppa:nginx/stable'], | 25 require => Exec['purge-nginx'], |
| 23 } | 26 } |
| 24 | 27 |
| 25 File { | 28 File { |
| 26 owner => root, | 29 owner => root, |
| 27 group => root, | 30 group => root, |
| 28 mode => 0644, | 31 mode => 0644, |
| 29 } | 32 } |
| 30 | 33 |
| 31 Exec { | 34 Exec { |
| 32 path => '/usr/bin:/bin', | 35 path => '/usr/bin:/bin', |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 ensure => absent | 106 ensure => absent |
| 104 } | 107 } |
| 105 } | 108 } |
| 106 } | 109 } |
| 107 | 110 |
| 108 if $enabled == true { | 111 if $enabled == true { |
| 109 | 112 |
| 110 if $is_default { | 113 if $is_default { |
| 111 $default_conf = '/etc/nginx/sites-enabled/default' | 114 $default_conf = '/etc/nginx/sites-enabled/default' |
| 112 ensure_resource('file', $default_conf, {ensure => 'absent'}) | 115 ensure_resource('file', $default_conf, {ensure => 'absent'}) |
| 113 File[$default_conf] ~> Service['nginx'] | 116 Package['nginx'] -> File[$default_conf] ~> Service['nginx'] |
| 114 } | 117 } |
| 115 | 118 |
| 116 file {"/etc/nginx/sites-enabled/${domain}": | 119 file {"/etc/nginx/sites-enabled/${domain}": |
| 117 ensure => link, | 120 ensure => link, |
| 118 require => File["/etc/nginx/sites-available/${domain}"], | 121 require => File["/etc/nginx/sites-available/${domain}"], |
| 119 target => "/etc/nginx/sites-available/${domain}", | 122 target => "/etc/nginx/sites-available/${domain}", |
| 120 notify => Service['nginx'] | 123 notify => Service['nginx'] |
| 121 } | 124 } |
| 122 } | 125 } |
| 123 | 126 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 } | 174 } |
| 172 | 175 |
| 173 service {'nginx': | 176 service {'nginx': |
| 174 ensure => running, | 177 ensure => running, |
| 175 enable => true, | 178 enable => true, |
| 176 restart => '/etc/init.d/nginx reload', | 179 restart => '/etc/init.d/nginx reload', |
| 177 hasstatus => true, | 180 hasstatus => true, |
| 178 require => File['/etc/nginx/nginx.conf'] | 181 require => File['/etc/nginx/nginx.conf'] |
| 179 } | 182 } |
| 180 } | 183 } |
| OLD | NEW |