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 include apt | 7 include apt |
8 | 8 |
9 apt::source {'nginx': | 9 apt::source {'nginx': |
10 location => "http://nginx.org/packages/ubuntu", | 10 location => "http://nginx.org/packages/ubuntu", |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 file {'/etc/nginx/sites-enabled': | 44 file {'/etc/nginx/sites-enabled': |
45 ensure => directory, | 45 ensure => directory, |
46 require => Package['nginx'] | 46 require => Package['nginx'] |
47 } | 47 } |
48 | 48 |
49 file {'/etc/nginx/sites-available/default': | 49 file {'/etc/nginx/sites-available/default': |
50 ensure => absent, | 50 ensure => absent, |
51 require => Package['nginx'] | 51 require => Package['nginx'] |
52 } | 52 } |
53 | 53 |
54 # file {'/etc/nginx/sites-enabled/default': | 54 define hostconfig ($file = $title, $source = undef, $content = undef, $enabled
= false) { |
55 # ensure => absent, | 55 if $content != undef { |
56 # } | 56 file {"/etc/nginx/sites-available/${file}": |
57 | 57 ensure => file, |
58 define hostconfig ($file = $title, $source, $enabled = false) { | 58 content => $content, |
59 file {"/etc/nginx/sites-available/${file}": | 59 require => Package['nginx'], |
60 ensure => file, | 60 notify => Service['nginx'], |
61 source => $source, | 61 } |
62 require => Package['nginx'], | 62 } |
63 notify => Service['nginx'], | 63 else { |
| 64 file {"/etc/nginx/sites-available/${file}": |
| 65 ensure => file, |
| 66 source => $source, |
| 67 require => Package['nginx'], |
| 68 notify => Service['nginx'], |
| 69 } |
64 } | 70 } |
65 if $enabled == true { | 71 if $enabled == true { |
66 file {"/etc/nginx/sites-enabled/${file}": | 72 file {"/etc/nginx/sites-enabled/${file}": |
67 ensure => link, | 73 ensure => link, |
68 require => File["/etc/nginx/sites-available/${file}"], | 74 require => File["/etc/nginx/sites-available/${file}"], |
69 target => "/etc/nginx/sites-available/${file}", | 75 target => "/etc/nginx/sites-available/${file}", |
70 notify => Service['nginx'] | 76 notify => Service['nginx'] |
71 } | 77 } |
72 } | 78 } |
73 } | 79 } |
74 | 80 |
75 file {'/etc/logrotate.d/nginx': | 81 file {'/etc/logrotate.d/nginx': |
76 source => 'puppet:///modules/nginx/logrotate', | 82 source => 'puppet:///modules/nginx/logrotate', |
77 require => Package['nginx'] | 83 require => Package['nginx'] |
78 } | 84 } |
79 | 85 |
80 service {'nginx': | 86 service {'nginx': |
81 ensure => running, | 87 ensure => running, |
82 enable => true, | 88 enable => true, |
83 restart => '/etc/init.d/nginx reload', | 89 restart => '/etc/init.d/nginx reload', |
84 hasstatus => true, | 90 hasstatus => true, |
85 require => File['/etc/nginx/nginx.conf'] | 91 require => File['/etc/nginx/nginx.conf'] |
86 } | 92 } |
87 } | 93 } |
OLD | NEW |