]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/otrs/recipes/default.rb
Add otrs test role from naga
[chef.git] / cookbooks / otrs / recipes / default.rb
index 8f2d8d6dbcc5c3b0247f69a00c120498997f254e..f16931b328b6d76ae02b5e2b993674a6242e0138 100644 (file)
@@ -25,13 +25,11 @@ include_recipe "tools"
 
 passwords = data_bag_item("otrs", "passwords")
 
-package "libapache2-mod-perl2"
-package "libapache2-reload-perl"
-
 package %w[
   tar
   bzip2
   libapache-dbi-perl
+  libapache2-reload-perl
   libarchive-zip-perl
   libauthen-ntlm-perl
   libauthen-sasl-perl
@@ -71,7 +69,13 @@ package %w[
   libyaml-perl
 ]
 
+apache_module "perl" do
+  package "libapache2-mod-perl2"
+end
+
+apache_module "deflate"
 apache_module "headers"
+apache_module "rewrite"
 
 version = node[:otrs][:version]
 user = node[:otrs][:user]
@@ -123,18 +127,19 @@ file "/opt/znuny-#{version}/Kernel/Config.pm" do
   group "www-data"
   mode "664"
   content config
+  notifies :restart, "service[otrs]"
 end
 
-link "/opt/otrs" do
-  to "/opt/znuny-#{version}"
-end
-
-execute "/opt/otrs/bin/otrs.SetPermissions.pl" do
-  action :run
-  command "/opt/otrs/bin/otrs.SetPermissions.pl --otrs-user=#{user} --web-group=www-data /opt/otrs-#{version}"
+execute "/opt/znuny-#{version}/bin/otrs.SetPermissions.pl" do
+  action :nothing
+  command "/opt/znuny-#{version}/bin/otrs.SetPermissions.pl --otrs-user=#{user} --web-group=www-data /opt/znuny-#{version}"
   user "root"
   group "root"
-  only_if { File.stat("/opt/otrs/README.md").uid != Etc.getpwnam("otrs").uid }
+  subscribes :run, "execute[untar-znuny-#{version}]"
+end
+
+link "/opt/otrs" do
+  to "/opt/znuny-#{version}"
 end
 
 systemd_service "otrs" do
@@ -151,6 +156,7 @@ end
 
 service "otrs" do
   action [:enable, :start]
+  subscribes :restart, "link[/opt/otrs]"
   subscribes :restart, "systemd_service[otrs]"
 end