summaryrefslogtreecommitdiff
path: root/puppet/modules
diff options
context:
space:
mode:
authorTulio Casagrande <tcasagra@thoughtworks.com>2017-01-16 15:15:41 -0200
committervarac <varacanero@zeromail.org>2017-01-18 18:44:21 +0100
commit5126584fe40f08b779a6f93e2d1b6b57bae29700 (patch)
treeb0aeb4387bdf4f7f3e6865f72294c47c0210b588 /puppet/modules
parent0117808a130c36f14f5b86879b52ed7ce2fa6d57 (diff)
Add apache auto-restart extension file
Diffstat (limited to 'puppet/modules')
-rw-r--r--puppet/modules/site_apache/files/auto_restart.conf2
-rw-r--r--puppet/modules/site_apache/manifests/common.pp1
-rw-r--r--puppet/modules/site_apache/manifests/common/extensions.pp14
-rw-r--r--puppet/modules/site_apache/spec/classes/extensions.rb7
-rw-r--r--puppet/modules/site_apache/spec/spec_helper.rb6
5 files changed, 30 insertions, 0 deletions
diff --git a/puppet/modules/site_apache/files/auto_restart.conf b/puppet/modules/site_apache/files/auto_restart.conf
new file mode 100644
index 00000000..8a764e34
--- /dev/null
+++ b/puppet/modules/site_apache/files/auto_restart.conf
@@ -0,0 +1,2 @@
+[Service]
+Restart=always
diff --git a/puppet/modules/site_apache/manifests/common.pp b/puppet/modules/site_apache/manifests/common.pp
index 208c15d5..c96932dd 100644
--- a/puppet/modules/site_apache/manifests/common.pp
+++ b/puppet/modules/site_apache/manifests/common.pp
@@ -28,5 +28,6 @@ class site_apache::common {
include site_apache::common::tls
include site_apache::common::acme
+ include site_apache::common::extensions
}
diff --git a/puppet/modules/site_apache/manifests/common/extensions.pp b/puppet/modules/site_apache/manifests/common/extensions.pp
new file mode 100644
index 00000000..ddeafae0
--- /dev/null
+++ b/puppet/modules/site_apache/manifests/common/extensions.pp
@@ -0,0 +1,14 @@
+class site_apache::common::extensions {
+
+ include ::systemd
+ file { '/etc/systemd/system/apache2.service.d/auto_restart.conf':
+ source => 'puppet:///modules/site_apache/auto_restart.conf',
+ owner => 'root',
+ group => 'root',
+ mode => '0644',
+ require => [
+ Service['apache']
+ ]
+ }~>
+ Exec['systemctl-daemon-reload']
+}
diff --git a/puppet/modules/site_apache/spec/classes/extensions.rb b/puppet/modules/site_apache/spec/classes/extensions.rb
new file mode 100644
index 00000000..164034c2
--- /dev/null
+++ b/puppet/modules/site_apache/spec/classes/extensions.rb
@@ -0,0 +1,7 @@
+require File.expand_path(File.join(File.dirname(__FILE__),'../spec_helper'))
+
+describe 'site_apache::common::extensions' do
+ it "should include apache autostart" do
+ should contain_file('/etc/systemd/system/apache2.service.d/auto_restart.conf').with_source('puppet:///modules/site_apache/apache_auto_restart.conf')
+ end
+end
diff --git a/puppet/modules/site_apache/spec/spec_helper.rb b/puppet/modules/site_apache/spec/spec_helper.rb
new file mode 100644
index 00000000..dea9e892
--- /dev/null
+++ b/puppet/modules/site_apache/spec/spec_helper.rb
@@ -0,0 +1,6 @@
+require 'rspec-puppet'
+
+RSpec.configure do |c|
+ c.module_path = File.expand_path(File.join(File.dirname(__FILE__), '..', '..'))
+ c.color = true
+end