]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/oxidized/recipes/default.rb
oxidized: fix broken usage of ssh_known_hosts_entry flush
[chef.git] / cookbooks / oxidized / recipes / default.rb
index 0ea5ec1f6184dcb14c1640cefe724f94e19191cf..014955f743c331fe55adad8735ec35721d04785c 100644 (file)
@@ -63,13 +63,25 @@ directory "/var/log/oxidized" do
   mode "755"
 end
 
-git "/opt/oxidized" do
+directory "/opt/oxidized" do
+  owner "oxidized"
+  group "oxidized"
+  mode "755"
+end
+
+git "/opt/oxidized/daemon" do
   action :sync
   repository "https://github.com/openstreetmap/oxidized.git"
   depth 1
   user "oxidized"
   group "oxidized"
-  notifies :run, "bundle_install[/opt/oxidized]"
+  notifies :run, "bundle_install[/opt/oxidized/daemon]"
+end
+
+directory "/opt/oxidized/.ssh" do
+  owner "oxidized"
+  group "oxidized"
+  mode "700"
 end
 
 # Key is set as a deployment key in github repo
@@ -95,6 +107,23 @@ execute "/opt/oxidized/.ssh/id_rsa.pub" do
   notifies :restart, "service[oxidized]"
 end
 
+ssh_known_hosts_entry "github.com" do
+  file_location "/opt/oxidized/.ssh/known_hosts"
+  owner "oxidized"
+  group "oxidized"
+end
+
+ssh_known_hosts_entry "github.com_flush" do
+  action :flush
+  file_location "/opt/oxidized/.ssh/known_hosts"
+end
+
+directory "/var/lib/oxidized" do
+  owner "oxidized"
+  group "oxidized"
+  mode "750"
+end
+
 git "/var/lib/oxidized/configs.git" do
   action :sync
   repository "git@github.com:openstreetmap/oxidized-configs.git" # Uses oxidized ssh key
@@ -103,7 +132,7 @@ git "/var/lib/oxidized/configs.git" do
   group "oxidized"
 end
 
-bundle_install "/opt/oxidized" do
+bundle_install "/opt/oxidized/daemon" do
   action :nothing
   options "--deployment"
   user "oxidized"
@@ -116,7 +145,8 @@ systemd_service "oxidized" do
   description "oxidized network device backup daemon"
   after "network.target"
   user "oxidized"
-  working_directory "/opt/oxidized"
+  working_directory "/opt/oxidized/daemon"
+  runtime_directory "oxidized"
   exec_start "#{node[:ruby][:bundle]} exec oxidized"
   environment "OXIDIZED_HOME" => "/etc/oxidized",
               "OXIDIZED_LOGS" => "/var/log/oxidized"