From 2918a56a9f8a0c05c9e132e8a95082b5f5d83484 Mon Sep 17 00:00:00 2001 From: Andrei Skopenko Date: Mon, 21 Aug 2017 14:57:08 +0300 Subject: [PATCH 1/2] Add cookbook for apache conf templates --- README.md | 2 ++ attributes/server_apache.rb | 2 ++ recipes/server_apache.rb | 2 ++ 3 files changed, 6 insertions(+) diff --git a/README.md b/README.md index 5482f2a..2b77b0e 100644 --- a/README.md +++ b/README.md @@ -2077,6 +2077,8 @@ Above LWRP resource will apply `Dependency` to all `Host` objects for provided ` * `default['icinga2']['apache_modules']` (default: `calculated`): apache modules / apache2 cookbook recipe to enable +* `default['icinga2']['apache_conf_cookbook']` (default: `icinga2`): cookbook for apache templates + ## Cookbook Icinga2 Constants Attributes diff --git a/attributes/server_apache.rb b/attributes/server_apache.rb index af5e281..5d261fb 100644 --- a/attributes/server_apache.rb +++ b/attributes/server_apache.rb @@ -8,3 +8,5 @@ %w(centos redhat fedora) => { '>= 7.0' => %w(default mod_wsgi mod_php5 mod_cgi mod_ssl mod_rewrite), 'default' => %w(default mod_python mod_php5 mod_cgi mod_ssl mod_rewrite) } ) + +default['icinga2']['apache_conf_cookbook'] = 'icinga2' diff --git a/recipes/server_apache.rb b/recipes/server_apache.rb index cc73598..a1b5aec 100644 --- a/recipes/server_apache.rb +++ b/recipes/server_apache.rb @@ -47,6 +47,7 @@ source "apache.vhost.icinga2_classic_ui.conf.#{apache_conf_file}.erb" owner node['apache']['user'] group node['apache']['group'] + cookbook node['icinga2']['apache_conf_cookbook'] notifies platform?('windows') ? :restart : :reload, 'service[apache2]', :delayed only_if { node['icinga2']['classic_ui']['enable'] } end @@ -55,6 +56,7 @@ source 'apache.vhost.icinga2_web2.erb' owner node['apache']['user'] group node['apache']['group'] + cookbook node['icinga2']['apache_conf_cookbook'] notifies platform?('windows') ? :restart : :reload, 'service[apache2]', :delayed variables(:web_root => node['icinga2']['web2']['web_root'], :web_uri => node['icinga2']['web2']['web_uri'], From f6e797a91f4a7c9cfa1fee3e570e8aef6feb9a67 Mon Sep 17 00:00:00 2001 From: Andrei Skopenko Date: Fri, 25 Aug 2017 10:30:28 +0300 Subject: [PATCH 2/2] Fix merge conflict --- README.md | 4 ++++ attributes/server_apache.rb | 2 ++ recipes/server_apache.rb | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 2b77b0e..1c5eb91 100644 --- a/README.md +++ b/README.md @@ -2079,6 +2079,10 @@ Above LWRP resource will apply `Dependency` to all `Host` objects for provided ` * `default['icinga2']['apache_conf_cookbook']` (default: `icinga2`): cookbook for apache templates +* `default['icinga2']['apache_classic_ui_template']` (default: `apache.vhost.icinga2_classic_ui.conf.#{node['platform_family']}.erb`): apache template for classic ui + +* `default['icinga2']['apache_web2_template']` (default: `apache.vhost.icinga2_web2.erb`): apache template for icingaweb2 + ## Cookbook Icinga2 Constants Attributes diff --git a/attributes/server_apache.rb b/attributes/server_apache.rb index 5d261fb..534159b 100644 --- a/attributes/server_apache.rb +++ b/attributes/server_apache.rb @@ -9,4 +9,6 @@ 'default' => %w(default mod_python mod_php5 mod_cgi mod_ssl mod_rewrite) } ) +default['icinga2']['apache_classic_ui_template'] = "apache.vhost.icinga2_classic_ui.conf.#{node['platform_family']}.erb" +default['icinga2']['apache_web2_template'] = 'apache.vhost.icinga2_web2.erb' default['icinga2']['apache_conf_cookbook'] = 'icinga2' diff --git a/recipes/server_apache.rb b/recipes/server_apache.rb index a1b5aec..83637ec 100644 --- a/recipes/server_apache.rb +++ b/recipes/server_apache.rb @@ -53,7 +53,7 @@ end template ::File.join(node['apache']['dir'], 'conf-available', 'icinga2-web2.conf') do - source 'apache.vhost.icinga2_web2.erb' + source node['icinga2']['apache_web2_template'] owner node['apache']['user'] group node['apache']['group'] cookbook node['icinga2']['apache_conf_cookbook']