]> git.openstreetmap.org Git - chef.git/commitdiff
Get chef cookbook working on debian
authorTom Hughes <tom@compton.nu>
Wed, 22 Mar 2023 22:26:48 +0000 (22:26 +0000)
committerTom Hughes <tom@compton.nu>
Wed, 22 Mar 2023 23:58:43 +0000 (23:58 +0000)
cookbooks/chef/recipes/default.rb

index 5a711398f1ce9a1962b1162a582101a9d3d9c0a8..d06162465a702d20ea9c29f5d9329a807f03c241 100644 (file)
 cache_dir = Chef::Config[:file_cache_path]
 
 chef_version = node[:chef][:client][:version]
+
+chef_platform = if platform?("debian")
+                  "debian"
+                else
+                  "ubuntu"
+                end
+
 chef_arch = if arm?
               "arm64"
             else
               "amd64"
             end
+
 chef_package = "chef_#{chef_version}-1_#{chef_arch}.deb"
 
 directory "/var/cache/chef" do
@@ -41,10 +49,10 @@ Dir.glob("#{cache_dir}/chef_*.deb").each do |deb|
   end
 end
 
-ubuntu_release = node[:lsb][:release]
+os_release = node[:lsb][:release]
 
 remote_file "#{cache_dir}/#{chef_package}" do
-  source "https://packages.chef.io/files/stable/chef/#{chef_version}/ubuntu/#{ubuntu_release}/#{chef_package}"
+  source "https://packages.chef.io/files/stable/chef/#{chef_version}/#{chef_platform}/#{os_release}/#{chef_package}"
   owner "root"
   group "root"
   mode "644"