diff options
author | Varac <varac@leap.se> | 2017-01-18 17:40:25 +0000 |
---|---|---|
committer | Varac <varac@leap.se> | 2017-01-18 17:40:25 +0000 |
commit | 8cba23d7308af4ed018d42935adee442e2e53134 (patch) | |
tree | 96135e4aed98a2e366d5ba1c05b37e2cdeebf901 /puppet/modules/site_apache | |
parent | dd189d2de941ec081261ced814a9c822e5ef02a1 (diff) | |
parent | 80e0ca380e92fe435622dbd35d1a5baedb6c3f92 (diff) |
Merge branch 'apache-auto-restart' into 'master'
Add apache auto-restart extension file
See merge request !66
Diffstat (limited to 'puppet/modules/site_apache')
4 files changed, 28 insertions, 0 deletions
diff --git a/puppet/modules/site_apache/files/autorestart.conf b/puppet/modules/site_apache/files/autorestart.conf new file mode 100644 index 00000000..8a764e34 --- /dev/null +++ b/puppet/modules/site_apache/files/autorestart.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..4847cbe3 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::autorestart } diff --git a/puppet/modules/site_apache/manifests/common/autorestart.pp b/puppet/modules/site_apache/manifests/common/autorestart.pp new file mode 100644 index 00000000..0273f272 --- /dev/null +++ b/puppet/modules/site_apache/manifests/common/autorestart.pp @@ -0,0 +1,18 @@ +# +# Adds autorestart extension to apache on crash +# +class site_apache::common::autorestart { + + file { '/etc/systemd/system/apache2.service.d': + ensure => directory, + mode => '0755', + } + + ::systemd::unit_file { 'apache2.service.d/autorestart.conf': + source => 'puppet:///modules/site_apache/autorestart.conf', + require => [ + File['/etc/systemd/system/apache2.service.d'], + Service['apache'], + ] + } +} diff --git a/puppet/modules/site_apache/spec/classes/autorestart_spec.rb b/puppet/modules/site_apache/spec/classes/autorestart_spec.rb new file mode 100644 index 00000000..ad9c9f2e --- /dev/null +++ b/puppet/modules/site_apache/spec/classes/autorestart_spec.rb @@ -0,0 +1,7 @@ +require 'spec_helper' + +describe 'site_apache::common::autorestart' do + it "should include apache autorestart" do + should contain_file('apache2.service.d/autorestart.conf').with_source('puppet:///modules/site_apache/autorestart.conf') + end +end |