]> git.openstreetmap.org Git - chef.git/commitdiff
Use sudo to run passenger-config when restarting taginfo
authorTom Hughes <tom@compton.nu>
Thu, 9 Apr 2015 17:52:37 +0000 (18:52 +0100)
committerTom Hughes <tom@compton.nu>
Thu, 9 Apr 2015 17:52:37 +0000 (18:52 +0100)
cookbooks/taginfo/recipes/default.rb
cookbooks/taginfo/templates/default/sudoers.erb [new file with mode: 0644]
cookbooks/taginfo/templates/default/update-taginfo.erb

index c384c66829ed5cdf15db53a6e56fcbd0da58c6c8..db09f48f15e66be424c3414401d9715cc4da439a 100644 (file)
@@ -69,6 +69,13 @@ file "/etc/logrotate.d/taginfo" do
   action :delete
 end
 
+template "/etc/sudoers.d/taginfo" do
+  source "sudoers.erb"
+  owner "root"
+  group "root"
+  mode 0440
+end
+
 node[:taginfo][:sites].each do |site|
   name = site[:name]
   directory = site[:directory] || "/srv/#{name}"
diff --git a/cookbooks/taginfo/templates/default/sudoers.erb b/cookbooks/taginfo/templates/default/sudoers.erb
new file mode 100644 (file)
index 0000000..907d234
--- /dev/null
@@ -0,0 +1,4 @@
+# DO NOT EDIT - This file is being maintained by Chef
+
+# Allow taginfo to restart the web app
+taginfo ALL=(root) NOPASSWD: /usr/bin/passenger-config restart-app *
index 4d09a658043760ea5ff55d7af6ada31360ab705f..652a53a67c3462ab4e0e9cc477192993a4324cd6 100644 (file)
@@ -19,6 +19,6 @@ mv $ROOT/data/taginfo-* $ROOT/data/old
 mv $ROOT/sources/taginfo-*.db $ROOT/sources/*/taginfo-*.db $ROOT/data
 mv $ROOT/sources/download/* $ROOT/download
 
-passenger-config restart-app $ROOT/taginfo/web > /dev/null
+sudo /usr/bin/passenger-config restart-app $ROOT/taginfo/web > /dev/null
 
 find $ROOT/sources/log -mtime +28 -delete