Browse Source

Fix races in httpd install and config

Add necessary dependency/ordering hints to the etherpad_lite::apache
class so that configuration parent directories are created before
they're needed rather than later through package installation, and
so that vhost configuration won't be loaded until Apache module
dependencies are in place.

Change-Id: Iaeafd30b19276ff438bd9e2708031c1064a2314d
Jeremy Stanley 3 years ago
parent
commit
86d9628a5a
1 changed files with 59 additions and 24 deletions
  1. 59
    24
      manifests/apache.pp

+ 59
- 24
manifests/apache.pp View File

@@ -24,43 +24,78 @@ class etherpad_lite::apache (
24 24
     template => 'etherpad_lite/etherpadlite.vhost.erb',
25 25
     ssl      => true,
26 26
   }
27
-  httpd_mod { 'rewrite':
28
-    ensure => present,
27
+
28
+  if !defined(Mod['rewrite']) {
29
+    httpd::mod { 'rewrite':
30
+      ensure => present,
31
+    }
29 32
   }
30
-  httpd_mod { 'proxy':
31
-    ensure => present,
33
+  if !defined(Mod['proxy']) {
34
+    httpd::mod { 'proxy':
35
+      ensure => present,
36
+    }
32 37
   }
33
-  httpd_mod { 'proxy_http':
34
-    ensure => present,
38
+  if !defined(Mod['proxy_http']) {
39
+    httpd::mod { 'proxy_http':
40
+      ensure => present,
41
+    }
35 42
   }
36 43
 
44
+  file { '/etc/apache2':
45
+    ensure => directory,
46
+    owner  => 'root',
47
+    group  => 'root',
48
+    mode   => '0755',
49
+  }
37 50
   if ($::lsbdistcodename == 'precise') {
51
+    file { '/etc/apache2/conf.d':
52
+      ensure  => directory,
53
+      owner   => 'root',
54
+      group   => 'root',
55
+      mode    => '0755',
56
+      require => File['/etc/apache2'],
57
+    }
38 58
     file { '/etc/apache2/conf.d/connection-tuning':
39
-      ensure => present,
40
-      owner  => 'root',
41
-      group  => 'root',
42
-      mode   => '0644',
43
-      source => 'puppet:///modules/etherpad_lite/apache-connection-tuning',
44
-      notify => Service['httpd'],
59
+      ensure  => present,
60
+      owner   => 'root',
61
+      group   => 'root',
62
+      mode    => '0644',
63
+      source  => 'puppet:///modules/etherpad_lite/apache-connection-tuning',
64
+      notify  => Service['httpd'],
65
+      require => File['/etc/apache2/conf.d'],
45 66
     }
46 67
   } else {
47
-    file { '/etc/apache2/conf-available/connection-tuning.conf':
48
-      ensure => present,
49
-      owner  => 'root',
50
-      group  => 'root',
51
-      mode   => '0644',
52
-      source => 'puppet:///modules/etherpad_lite/apache-connection-tuning',
68
+    file { '/etc/apache2/conf-available':
69
+      ensure  => directory,
70
+      owner   => 'root',
71
+      group   => 'root',
72
+      mode    => '0755',
73
+      require => File['/etc/apache2'],
74
+    }
75
+    file { '/etc/apache2/conf-available/connection-tuning':
76
+      ensure  => present,
77
+      owner   => 'root',
78
+      group   => 'root',
79
+      mode    => '0644',
80
+      source  => 'puppet:///modules/etherpad_lite/apache-connection-tuning',
81
+      require => File['/etc/apache2/conf-available'],
53 82
     }
54 83
 
55
-    file { '/etc/apache2/conf-enabled/connection-tuning.conf':
84
+    file { '/etc/apache2/conf-enabled':
85
+      ensure  => directory,
86
+      owner   => 'root',
87
+      group   => 'root',
88
+      mode    => '0755',
89
+      require => File['/etc/apache2'],
90
+    }
91
+    file { '/etc/apache2/conf-enabled/connection-tuning':
56 92
       ensure  => link,
57 93
       target  => '/etc/apache2/conf-available/connection-tuning.conf',
58 94
       notify  => Service['httpd'],
59
-      require => File['/etc/apache2/conf-available/connection-tuning.conf'],
60
-    }
61
-
62
-    httpd_mod { 'proxy_wstunnel':
63
-      ensure => present,
95
+      require => [
96
+        File['/etc/apache2/conf-enabled'],
97
+        File['/etc/apache2/conf-available/connection-tuning'],
98
+      ],
64 99
     }
65 100
   }
66 101
 

Loading…
Cancel
Save