Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decouple management of Apache virtual host #31

Open
alex-harvey-z3q opened this issue Aug 30, 2014 · 7 comments
Open

Decouple management of Apache virtual host #31

alex-harvey-z3q opened this issue Aug 30, 2014 · 7 comments

Comments

@alex-harvey-z3q
Copy link

Finally I have two patches that attempt to decouple management of the Apache virtual host so that the Puppet Labs apache module can be used if desired to manage the virtual host instead. I apologise that I haven't fully understood the problem the author was trying to solve or all aspects of his solution although I think the concept is valid. Would a cleaned up version of the patches below be welcome?

diff --git a/manifests/server.pp b/manifests/server.pp
index 0a61da4..dd455b9 100644
--- a/manifests/server.pp
+++ b/manifests/server.pp
@@ -163,30 +163,29 @@ class nagios::server (
     require   => Package['nagios'],
   }

-  file { '/etc/httpd/conf.d/nagios.conf':
-    owner   => 'root',
-    group   => 'root',
-    mode    => '0644',
-    content => $apache_httpd_conf_content,
-    notify  => Service['httpd'],
-    require => Package['nagios'],
-  }
-  if $apache_httpd_htpasswd_source != false {
-    file { '/etc/nagios/.htpasswd':
-      owner   => 'root',
-      group   => 'apache',
-      mode    => '0640',
-      source  => $apache_httpd_htpasswd_source,
-      require => Package['nagios'],
-    }
-  }
-
   if $apache_httpd {
     apache_httpd { 'prefork':
       ssl       => $apache_httpd_ssl,
       modules   => $apache_httpd_modules,
       keepalive => 'On',
     }
+    file { '/etc/httpd/conf.d/nagios.conf':
+      owner   => 'root',
+      group   => 'root',
+      mode    => '0644',
+      content => $apache_httpd_conf_content,
+      notify  => Service['httpd'],
+      require => Package['nagios'],
+    }
+    if $apache_httpd_htpasswd_source != false {
+      file { '/etc/nagios/.htpasswd':
+        owner   => 'root',
+        group   => 'apache',
+        mode    => '0640',
+        source  => $apache_httpd_htpasswd_source,
+        require => Package['nagios'],
+      }
+    }
   }

   if $php {

And

diff --git a/manifests/server.pp b/manifests/server.pp
index dd455b9..8f405a7 100644
--- a/manifests/server.pp
+++ b/manifests/server.pp
@@ -16,8 +16,7 @@ class nagios::server (
     'rewrite',
     'cgi',
   ],
-  # The apache config snippet, more useful as a template when using a custom
-  $apache_httpd_conf_content    = template('nagios/apache_httpd/httpd-nagios.conf.erb'),
+
   $apache_allowed_from          = [],   # Allow access to the web in the previous template
   $apache_httpd_htpasswd_source = "puppet:///modules/${module_name}/apache_httpd/htpasswd",
   $php     = true,
@@ -164,6 +163,8 @@ class nagios::server (
   }

   if $apache_httpd {
+    # The apache config snippet, more useful as a template when using a custom
+    $apache_httpd_conf_content    = template('nagios/apache_httpd/httpd-nagios.conf.erb')
     apache_httpd { 'prefork':
       ssl       => $apache_httpd_ssl,
       modules   => $apache_httpd_modules,
@neoice
Copy link

neoice commented Sep 2, 2014

+1

https://forge.puppetlabs.com/puppetlabs/apache seems to be widely used and accepted.

I'm not sure how much benefit there is for the author to re-invent the wheel on apache/httpd management.

@thias
Copy link
Owner

thias commented Sep 18, 2014

@neoice : Both this nagios module and my apache_httpd module pre-date the puppetlabs-apache module being in an acceptable state ;-)

@alex-harvey-z3q
Copy link
Author

So should I submit the above as a pull request?

@alex-harvey-z3q
Copy link
Author

Ping - last issue that's standing in the way of me using this module rather than a local fork

@neoice
Copy link

neoice commented Dec 11, 2014

@alexharv074 do you have a PR? I'd love to take a look and maybe use it myself.

@alex-harvey-z3q
Copy link
Author

@neoice I'm afraid I gave up trying to get the author's attention but my diff is above.

@alex-harvey-z3q
Copy link
Author

@thias ping ping ping. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants