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 - Migrate Trac setup to nginx::hostconfig-fragment Created Aug. 13, 2014, 9:24 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') | no next file with comments »
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 }
63 }
64
47 define hostconfig ( 65 define hostconfig (
48 $domain = $title, 66 $domain = $title,
49 $alt_names = [], 67 $alt_names = [],
50 $log, 68 $log,
51 $is_default = false, 69 $is_default = false,
52 $source = undef, 70 $source = undef,
53 $content = undef, 71 $content = undef,
54 $global_config = undef, 72 $global_config = undef,
55 $certificate = undef, 73 $certificate = undef,
56 $private_key = undef, 74 $private_key = undef,
57 $enabled = true) { 75 $enabled = true) {
76
77 file {"${nginx::fragment_directory}/${domain}":
78 ensure => directory,
79 require => File[$nginx::fragment_directory],
80 }
81
58 file {"/etc/nginx/sites-available/${domain}": 82 file {"/etc/nginx/sites-available/${domain}":
59 ensure => file, 83 ensure => file,
60 content => template('nginx/site.erb'), 84 content => template('nginx/site.erb'),
61 require => Package['nginx'], 85 require => Package['nginx'],
62 notify => Service['nginx'], 86 notify => Service['nginx'],
63 } 87 }
64 88
65 if $certificate and $private_key { 89 if $certificate and $private_key {
66 if !defined(File["/etc/nginx/${certificate}"]) { 90 if !defined(File["/etc/nginx/${certificate}"]) {
67 file {"/etc/nginx/${certificate}": 91 file {"/etc/nginx/${certificate}":
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 } 144 }
121 145
122 service {'nginx': 146 service {'nginx':
123 ensure => running, 147 ensure => running,
124 enable => true, 148 enable => true,
125 restart => '/etc/init.d/nginx reload', 149 restart => '/etc/init.d/nginx reload',
126 hasstatus => true, 150 hasstatus => true,
127 require => File['/etc/nginx/nginx.conf'] 151 require => File['/etc/nginx/nginx.conf']
128 } 152 }
129 } 153 }
OLDNEW
« no previous file with comments | « no previous file | modules/nginx/templates/site.erb » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld