Vendor the external cookbooks

Knife-Zero doesn't include Berkshelf support, so vendoring everything in
the repo is convenient again
This commit is contained in:
Greg Karékinian
2019-10-13 19:17:42 +02:00
parent f4bfe31ac1
commit a32f34b408
1245 changed files with 100630 additions and 0 deletions

View File

@@ -0,0 +1,45 @@
#
# Cookbook:: apache2
# Definition:: apache_conf
#
# Copyright:: 2008-2013, Chef Software, Inc.
#
# 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
#
# http://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.
#
define :apache_conf, enable: true do
include_recipe 'apache2::default'
conf_name = "#{params[:name]}.conf"
params[:conf_path] = params[:conf_path] || "#{node['apache']['dir']}/conf-available"
file "#{params[:conf_path]}/#{params[:name]}" do
action :delete
end
template "#{params[:conf_path]}/#{conf_name}" do
source params[:source] || "#{conf_name}.erb"
cookbook params[:cookbook] if params[:cookbook]
owner 'root'
group node['apache']['root_group']
backup false
mode '0644'
notifies :restart, 'service[apache2]', :delayed
end
if params[:enable]
apache_config params[:name] do
enable true
end
end
end

View File

@@ -0,0 +1,42 @@
#
# Cookbook:: apache2
# Definition:: apache_config
#
# Copyright:: 2008-2013, Chef Software, Inc.
#
# 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
#
# http://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.
#
define :apache_config, enable: true do
include_recipe 'apache2::default'
conf_name = "#{params[:name]}.conf"
params[:conf_path] = params[:conf_path] || "#{node['apache']['dir']}/conf-available"
if params[:enable]
execute "a2enconf #{conf_name}" do
command "/usr/sbin/a2enconf #{conf_name}"
notifies :restart, 'service[apache2]', :delayed
not_if do
::File.symlink?("#{node['apache']['dir']}/conf-enabled/#{conf_name}") &&
(::File.exist?(params[:conf_path]) ? ::File.symlink?("#{node['apache']['dir']}/conf-enabled/#{conf_name}") : true)
end
end
else
execute "a2disconf #{conf_name}" do
command "/usr/sbin/a2disconf #{conf_name}"
notifies :reload, 'service[apache2]', :delayed
only_if { ::File.symlink?("#{node['apache']['dir']}/conf-enabled/#{conf_name}") }
end
end
end

View File

@@ -0,0 +1,28 @@
#
# Cookbook:: apache2
# Definition:: apache_mod
#
# Copyright:: 2008-2013, Chef Software, Inc.
#
# 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
#
# http://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.
#
define :apache_mod do
include_recipe 'apache2::default'
template "#{node['apache']['dir']}/mods-available/#{params[:name]}.conf" do
source "mods/#{params[:name]}.conf.erb"
mode '0644'
notifies :reload, 'service[apache2]', :delayed
end
end

View File

@@ -0,0 +1,58 @@
#
# Cookbook:: apache2
# Definition:: apache_module
#
# Copyright:: 2008-2013, Chef Software, Inc.
#
# 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
#
# http://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.
#
define :apache_module, enable: true, conf: false, restart: false do
include_recipe 'apache2::default'
params[:filename] = params[:filename] || "mod_#{params[:name]}.so"
params[:module_path] = params[:module_path] || "#{node['apache']['libexec_dir']}/#{params[:filename]}"
params[:identifier] = params[:identifier] || "#{params[:name]}_module"
apache_mod params[:name] if params[:conf]
file "#{node['apache']['dir']}/mods-available/#{params[:name]}.load" do
content "LoadModule #{params[:identifier]} #{params[:module_path]}\n"
mode '0644'
end
if params[:enable]
execute "a2enmod #{params[:name]}" do
command "/usr/sbin/a2enmod #{params[:name]}"
if params[:restart]
notifies :restart, 'service[apache2]', :delayed
else
notifies :reload, 'service[apache2]', :delayed
end
not_if do
::File.symlink?("#{node['apache']['dir']}/mods-enabled/#{params[:name]}.load") &&
(::File.exist?("#{node['apache']['dir']}/mods-available/#{params[:name]}.conf") ? ::File.symlink?("#{node['apache']['dir']}/mods-enabled/#{params[:name]}.conf") : true)
end
end
else
execute "a2dismod #{params[:name]}" do
command "/usr/sbin/a2dismod #{params[:name]}"
if params[:restart]
notifies :restart, 'service[apache2]', :delayed
else
notifies :reload, 'service[apache2]', :delayed
end
only_if { ::File.symlink?("#{node['apache']['dir']}/mods-enabled/#{params[:name]}.load") }
end
end
end

View File

@@ -0,0 +1,44 @@
#
# Cookbook:: apache2
# Definition:: apache_site
#
# Copyright:: 2008-2013, Chef Software, Inc.
#
# 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
#
# http://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.
#
define :apache_site, enable: true do
include_recipe 'apache2::default'
conf_name = "#{params[:name]}.conf"
if params[:enable]
execute "a2ensite #{conf_name}" do
command "/usr/sbin/a2ensite #{conf_name}"
notifies :reload, 'service[apache2]', :delayed
not_if do
::File.symlink?("#{node['apache']['dir']}/sites-enabled/#{conf_name}") ||
::File.symlink?("#{node['apache']['dir']}/sites-enabled/000-#{conf_name}")
end
only_if { ::File.exist?("#{node['apache']['dir']}/sites-available/#{conf_name}") }
end
else
execute "a2dissite #{conf_name}" do
command "/usr/sbin/a2dissite #{conf_name}"
notifies :reload, 'service[apache2]', :delayed
only_if do
::File.symlink?("#{node['apache']['dir']}/sites-enabled/#{conf_name}") ||
::File.symlink?("#{node['apache']['dir']}/sites-enabled/000-#{conf_name}")
end
end
end
end

View File

@@ -0,0 +1,48 @@
#
# Cookbook:: apache2
# Definition:: web_app
#
# Copyright:: 2008-2013, Chef Software, Inc.
#
# 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
#
# http://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.
#
define :web_app, template: 'web_app.conf.erb', local: false, enable: true, server_port: 80 do
application_name = params[:name]
include_recipe 'apache2::default'
include_recipe 'apache2::mod_rewrite'
include_recipe 'apache2::mod_deflate'
include_recipe 'apache2::mod_headers'
template "#{node['apache']['dir']}/sites-available/#{application_name}.conf" do
source params[:template]
local params[:local]
owner 'root'
group node['apache']['root_group']
mode '0644'
cookbook params[:cookbook] if params[:cookbook]
variables(
application_name: application_name,
params: params
)
if ::File.exist?("#{node['apache']['dir']}/sites-enabled/#{application_name}.conf")
notifies :reload, 'service[apache2]', :delayed
end
end
site_enabled = params[:enable]
apache_site params[:name] do
enable site_enabled
end
end