Puppet Class: dockerinstall::compose
- Inherits:
- dockerinstall::globals
- Defined in:
- manifests/compose.pp
Summary
Docker Compose installationOverview
Docker Compose installation
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'manifests/compose.pp', line 11
class dockerinstall::compose (
String $download_name = $dockerinstall::globals::compose_download_name,
String $checksum_name = $dockerinstall::globals::compose_checksum_name,
String $checksum_command = $dockerinstall::params::compose_checksum_command,
Stdlib::Absolutepath
$tmpdir = $dockerinstall::params::download_tmpdir,
Stdlib::Absolutepath
$binary_path = $dockerinstall::params::compose_binary_path,
Stdlib::Absolutepath
$rundir = $dockerinstall::params::compose_rundir,
Stdlib::Absolutepath
$libdir = $dockerinstall::params::compose_libdir,
String $binary_ensure = 'file',
Boolean $install_plugin = $dockerinstall::globals::install_plugin,
) inherits dockerinstall::globals
{
$download_version = $dockerinstall::globals::compose_download_version
# in URL base folder located Docker Compose binary and checksum
$download_url_base = $dockerinstall::globals::compose_download_urlbase
$plugin_path = $dockerinstall::params::compose_plugin_path
# we store all checksum files in temporary folder, therefore add suffix to
# not overwrite
$checksum_version_name = "${checksum_name}.${download_version}"
$checksum_download_path = "${tmpdir}/${checksum_version_name}"
if $binary_ensure == 'file' {
exec {
default:
path => '/bin:/usr/bin',
cwd => $tmpdir,
;
# download checksm file into temporary directory
'docker-compose-checksum':
command => "curl -L ${download_url_base}/${checksum_name} -o ${checksum_version_name}",
# creates => $checksum_download_path,
unless => "grep ${download_name} ${checksum_download_path}",
;
# download binary if checksum not match
'docker-compose-download':
command => "curl -L ${download_url_base}/${download_name} -o ${download_name}",
unless => "${checksum_command} -c ${checksum_version_name}",
require => Exec['docker-compose-checksum'],
notify => File['docker-compose'],
;
}
$compose_setup = {
source => "file://${tmpdir}/${download_name}",
mode => '0755',
owner => 'root',
group => 'root',
}
if $install_plugin {
file { 'docker-compose-plugin':
ensure => file,
source => "file://${tmpdir}/${download_name}",
mode => '0755',
owner => 'root',
group => 'root',
path => $plugin_path,
require => Exec['docker-compose-download'],
}
}
}
else {
$compose_setup = {}
}
# install binary into specified location (by default is
# /usr/local/bin/docker-compose)
file { 'docker-compose':
* => $compose_setup,
ensure => $binary_ensure,
path => $binary_path,
}
file { [$rundir, $libdir]:
ensure => directory,
mode => '0755',
force => true,
}
}
|