Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: modules/nginx/manifests/init.pp

Issue 5731052198821888: #1203 - Establish nginx::hostconfig-fragment() directive (Closed)
Patch Set: #1203 - Establish nginx::hostconfig-fragment() directive Created Aug. 13, 2014, 9:49 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | modules/nginx/templates/site.erb » ('j') | modules/trac/manifests/init.pp » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 $fragment_directory = "/etc/nginx/fragments",
5 ) inherits nginx::params { 6 ) inherits nginx::params {
6 7
7 apt::source {'nginx': 8 apt::source {'nginx':
8 location => "http://nginx.org/packages/ubuntu", 9 location => "http://nginx.org/packages/ubuntu",
9 repos => "nginx", 10 repos => "nginx",
10 key => "ABF5BD827BD9BF62", 11 key => "ABF5BD827BD9BF62",
11 key_source => "http://nginx.org/keys/nginx_signing.key" 12 key_source => "http://nginx.org/keys/nginx_signing.key"
12 } 13 }
13 14
14 # Ensures that nginx is not installed from the Ubuntu sources 15 # Ensures that nginx is not installed from the Ubuntu sources
(...skipping 22 matching lines...) Expand all
37 file {'/etc/nginx/sites-available': 38 file {'/etc/nginx/sites-available':
38 ensure => directory, 39 ensure => directory,
39 require => Package['nginx'] 40 require => Package['nginx']
40 } 41 }
41 42
42 file {'/etc/nginx/sites-enabled': 43 file {'/etc/nginx/sites-enabled':
43 ensure => directory, 44 ensure => directory,
44 require => Package['nginx'] 45 require => Package['nginx']
45 } 46 }
46 47
48 file {$fragment_directory:
49 ensure => directory,
50 require => Package['nginx'],
51 }
52
53 define hostconfig-fragment (
54 $domain,
55 $content = undef,
56 $ensure = 'present') {
57
58 file {"${$nginx::fragment_directory}/${domain}/${name}.conf":
59 content => $content,
60 ensure => $ensure,
61 require => File["${nginx::fragment_directory}/${domain}"],
62 notify => Service['nginx'],
63 }
64 }
65
47 define hostconfig ( 66 define hostconfig (
48 $domain = $title, 67 $domain = $title,
49 $alt_names = [], 68 $alt_names = [],
50 $log, 69 $log,
51 $is_default = false, 70 $is_default = false,
52 $source = undef, 71 $source = undef,
53 $content = undef, 72 $content = undef,
54 $global_config = undef, 73 $global_config = undef,
55 $certificate = undef, 74 $certificate = undef,
56 $private_key = undef, 75 $private_key = undef,
57 $enabled = true) { 76 $enabled = true) {
77
78 file {"${nginx::fragment_directory}/${domain}":
79 ensure => directory,
80 require => File[$nginx::fragment_directory],
81 }
82
58 file {"/etc/nginx/sites-available/${domain}": 83 file {"/etc/nginx/sites-available/${domain}":
59 ensure => file, 84 ensure => file,
60 content => template('nginx/site.erb'), 85 content => template('nginx/site.erb'),
61 require => Package['nginx'], 86 require => Package['nginx'],
62 notify => Service['nginx'], 87 notify => Service['nginx'],
63 } 88 }
64 89
65 if $certificate and $private_key { 90 if $certificate and $private_key {
66 if !defined(File["/etc/nginx/${certificate}"]) { 91 if !defined(File["/etc/nginx/${certificate}"]) {
67 file {"/etc/nginx/${certificate}": 92 file {"/etc/nginx/${certificate}":
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 } 145 }
121 146
122 service {'nginx': 147 service {'nginx':
123 ensure => running, 148 ensure => running,
124 enable => true, 149 enable => true,
125 restart => '/etc/init.d/nginx reload', 150 restart => '/etc/init.d/nginx reload',
126 hasstatus => true, 151 hasstatus => true,
127 require => File['/etc/nginx/nginx.conf'] 152 require => File['/etc/nginx/nginx.conf']
128 } 153 }
129 } 154 }
OLDNEW
« no previous file with comments | « no previous file | modules/nginx/templates/site.erb » ('j') | modules/trac/manifests/init.pp » ('J')

Powered by Google App Engine
This is Rietveld