mirror of
https://github.com/rapid7/metasploitable3.git
synced 2024-07-07 12:12:24 +02:00
Tweaks to the recipes to avoid repetition of work, and ub1404 dev, * let apt cookbook handle apt-update globally * do not download, configure, make, make install if the package is already installed * add guards for file deletion to first check whether file is present * use docker cookbook for image building and running, to only build if not alrady built and only run if not already running * drop mysql table and recreate each time Also, * bump Docker cookbook to 4.9.3 * bump mysql cookbook to 8.5.1 * add apt cookbook for better apt-update management * bump depends versions and add apt * modify readme with customization instructions * modify all chef runlists to call apt first in the runlist * add a vagrantfile for dev of ub1404
43 lines
1.4 KiB
Ruby
43 lines
1.4 KiB
Ruby
module MysqlCookbook
|
|
class MysqlServerInstallationPackage < MysqlBase
|
|
# Resource properties
|
|
resource_name :mysql_server_installation_package
|
|
provides :mysql_server_installation, os: 'linux'
|
|
|
|
property :package_name, String, default: lazy { default_server_package_name }, desired_state: false
|
|
property :package_options, [String, nil], desired_state: false
|
|
property :package_version, [String, nil], default: nil, desired_state: false
|
|
|
|
# helper methods
|
|
require_relative 'helpers'
|
|
include MysqlCookbook::HelpersBase
|
|
|
|
# Actions
|
|
action :install do
|
|
package new_resource.package_name do
|
|
version new_resource.package_version if new_resource.package_version
|
|
options new_resource.package_options if new_resource.package_options
|
|
notifies :install, 'package[perl-Sys-Hostname-Long]', :immediately if platform_family?('suse')
|
|
notifies :run, 'execute[Initial DB setup script]', :immediately if platform_family?('suse')
|
|
action :install
|
|
end
|
|
|
|
package 'perl-Sys-Hostname-Long' do
|
|
action :nothing
|
|
end
|
|
|
|
execute 'Initial DB setup script' do
|
|
environment 'INSTANCE' => new_resource.name
|
|
command '/usr/lib/mysql/mysql-systemd-helper install'
|
|
action :nothing
|
|
end
|
|
end
|
|
|
|
action :delete do
|
|
package new_resource.package_name do
|
|
action :remove
|
|
end
|
|
end
|
|
end
|
|
end
|