mirror of
https://github.com/rapid7/metasploitable3.git
synced 2024-09-13 00:00:48 +02:00
126949ce19
This reverts commit 50a8a91c71
.
52 lines
1.1 KiB
Ruby
52 lines
1.1 KiB
Ruby
module DockerCookbook
|
|
class DockerInstallationScript < DockerBase
|
|
#####################
|
|
# Resource properties
|
|
#####################
|
|
resource_name :docker_installation_script
|
|
|
|
provides :docker_installation, os: 'linux'
|
|
|
|
property :repo, %w(main test experimental), default: 'main', desired_state: false
|
|
property :script_url, String, default: lazy { default_script_url }, desired_state: false
|
|
|
|
default_action :create
|
|
|
|
################
|
|
# helper methods
|
|
################
|
|
|
|
def default_script_url
|
|
case repo
|
|
when 'main'
|
|
'https://get.docker.com/'
|
|
when 'test'
|
|
'https://test.docker.com/'
|
|
when 'experimental'
|
|
'https://experimental.docker.com/'
|
|
end
|
|
end
|
|
|
|
#########
|
|
# Actions
|
|
#########
|
|
|
|
action :create do
|
|
package 'curl' do
|
|
action :install
|
|
end
|
|
|
|
execute 'install docker' do
|
|
command "curl -sSL #{script_url} | sh"
|
|
creates '/usr/bin/docker'
|
|
end
|
|
end
|
|
|
|
action :delete do
|
|
package 'docker-engine' do
|
|
action :remove
|
|
end
|
|
end
|
|
end
|
|
end
|