From: Tom Hughes Date: Tue, 12 Oct 2021 17:57:49 +0000 (+0000) Subject: Add recipe to handle installing knife correctly X-Git-Url: https://git.openstreetmap.org./chef.git/commitdiff_plain/6eeae3e09398705b597a0fa739f78e621400b574?hp=b413a8a17bc14d4503fe4d6432223a5f45c5286e Add recipe to handle installing knife correctly --- diff --git a/cookbooks/chef/recipes/knife.rb b/cookbooks/chef/recipes/knife.rb new file mode 100644 index 000000000..2c965084f --- /dev/null +++ b/cookbooks/chef/recipes/knife.rb @@ -0,0 +1,26 @@ +# +# Cookbook:: chef +# Recipe:: knife +# +# Copyright:: 2021, OpenStreetMap Foundation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +package %w[ + gcc + libc6-dev + make +] + +chef_gem "knife" diff --git a/cookbooks/chef/recipes/repository.rb b/cookbooks/chef/recipes/repository.rb index cd0e86838..752938bf3 100644 --- a/cookbooks/chef/recipes/repository.rb +++ b/cookbooks/chef/recipes/repository.rb @@ -17,6 +17,7 @@ # limitations under the License. # +include_recipe "chef::knife" include_recipe "git" keys = data_bag_item("chef", "keys") @@ -25,8 +26,6 @@ chef_gem "bundler" do version ">= 2.1.4" end -chef_gem "knife" - directory "/var/lib/chef" do owner "chefrepo" group "chefrepo" diff --git a/cookbooks/chef/recipes/server.rb b/cookbooks/chef/recipes/server.rb index c6ee6f7eb..cd54cf426 100644 --- a/cookbooks/chef/recipes/server.rb +++ b/cookbooks/chef/recipes/server.rb @@ -18,6 +18,7 @@ # include_recipe "apache" +include_recipe "chef::knife" include_recipe "munin" # cache_dir = Chef::Config[:file_cache_path] @@ -48,8 +49,6 @@ include_recipe "munin" # notifies :run, "execute[chef-server-reconfigure]" # end -chef_gem "knife" - template "/etc/opscode/chef-server.rb" do source "server.rb.erb" owner "root" diff --git a/cookbooks/letsencrypt/metadata.rb b/cookbooks/letsencrypt/metadata.rb index 50f1874b2..52ef99f7c 100644 --- a/cookbooks/letsencrypt/metadata.rb +++ b/cookbooks/letsencrypt/metadata.rb @@ -8,3 +8,4 @@ version "1.0.0" supports "ubuntu" depends "accounts" depends "apache" +depends "chef" diff --git a/cookbooks/letsencrypt/recipes/default.rb b/cookbooks/letsencrypt/recipes/default.rb index ed18254cc..92c78a51d 100644 --- a/cookbooks/letsencrypt/recipes/default.rb +++ b/cookbooks/letsencrypt/recipes/default.rb @@ -19,6 +19,7 @@ include_recipe "accounts" include_recipe "apache" +include_recipe "chef::knife" keys = data_bag_item("chef", "keys") @@ -27,8 +28,6 @@ package %w[ ruby ] -chef_gem "knife" - directory "/etc/letsencrypt" do owner "letsencrypt" group "letsencrypt"